Resources‎ > ‎Tips and Tricks‎ > ‎Excel‎ > ‎VBA‎ > ‎

Commonly used statements in VBA


Disables prompts such as "Are you sure you want to delete this sheet?"
Application.DisplayAlerts = False

Disable the screen from refreshing. Good when looping through rows or cells with lots of changes to cells.
Application.ScreenUpdating = False 

Save a copy of the workbook.  Relative path names will save starting from the folder the file was opened in.
ActiveWorkbook.SaveCopyAs "filename"



Hiding sheets

Worksheets(sheetName).Visible = xlSheetHidden
Worksheets(sheetName).Visible = xlSheetVeryHidden 'Needs VBA to unhide



Search and replace
Range.Replace What:="originalString", Replacement:="newString", LookAt:=xlPart, MatchCase:=False