ref. : https://msdn.microsoft.com/en-us/VBA/Excel-VBA/articles/object-model-excel-vba-reference
ActiveWorkbook.Sheets.Add after:=Worksheets(Worksheets.Count)
autofilter ( http://www.contextures.com/xlautofilter03.html )
ThisWorkbook.Sheets(1).AutoFilterMode = False
With Range(Cells(11, "L"), Cells(lst_row, "AL"))
.AutoFilter
.AutoFilter Field:=1, Criteria1:="=bank", Operator:=xlOr, Criteria2:="=city"
.AutoFilter Field:=25, Criteria1:="<>#N/A"
End With
If Not ActiveSheet.AutoFilterMode Then
ActiveSheet.Range("A1").AutoFilter
End If
ActiveSheet.AutoFilterMode = False
Application.Calculation = xlManual Application.Calculation = xlAutomatic
ActiveWorkbook.Close SaveChanges:=True ActiveWorkbook.Close SaveChanges:=False
Range(Cells(12, "AH"), Cells(12, "AL")).Copy Range(Cells(13, "AH"), Cells(lst_row, "AL")) Application.CutCopyMode = False
Workbooks(fl_priv).Sheets("SheetName").Copy Before:=Workbooks(fl_comb).Sheets(5)
MsgBox " first line" & vbCrLf & _
" second line" _
, vbYesNo
Workbooks.Open Filename:=ThisWorkbook.Path & "\settle.csv"
Shell "D:\Programs\FirefoxPortable\FirefoxPortable.exe http://www.web.net/index.html", vbNormalFocus
Workbooks.Add ActiveWorkbook.SaveAs Filename:="E:" & filename & ".xlsx"
Set Fold = CreateObject("shell.application").BrowseForFolder(0, "Please select folder:", 0, 0) 'from desktop If Fold Is Nothing Then Exit Sub 'exit while no selection filepath = Fold.Items.Item.Path & "" 'set data path
FileToOpen = Application.GetOpenFilename (Title:="Please choose a file to open", FileFilter:="Excel Files .xls (.xls),") If FileToOpen = False Then MsgBox "No file selected.", vbExclamation, "Sorry!" Exit Sub Else Workbooks.Open Filename:=FileToOpen End If
Selection.SpecialCells(xlCellTypeVisible).Select Selection.SpecialCells(xlCellTypeBlanks).Select
ref. : https://docs.microsoft.com/en-us/office/vba/api/excel.application.sendkeys
Application.SendKeys ("{F2}")
Application.SendKeys ("0")
Application.SendKeys ("%~")
Application.SendKeys ("{RETURN} ")
Range("A2:A10").Select
Selection.TextToColumns DataType:=xlDelimited, Tab:=True, FieldInfo:=Array(Array(1, 1), Array(2, 2))
Range(Cells(1, 1), Cells.SpecialCells(xlCellTypeLastCell)).Select
With ActiveDocument.MailMerge .Destination = wdSendToNewDocument .SuppressBlankLines = True With .DataSource .FirstRecord = 1 .LastRecord = 1 End With .Execute Pause:=False End With
put ThisWorkbook.Close under Private Sub Workbook_Open() in ThisWorkbook - Workbook by mistake
solution: in a temp file run VBA code Application.EnableEvents = False
will stop VBA run
then use below code to restore Application.EnableEvents = True