Stop searching. Start learning and developing your excel skills.
Macro
VBA
Formula
Function
Shortcut
Tricks

» » VBA Common Commands

VBA Common Commands

June 03, 2017 |
This is also related to below queries:
  1. excel vba commands list
  2. useful vba codes for excel
  3. visual basic programming commands
Most frequently used VBA Commands by Programmers:
  1. Application.ScreenUpdating → Turn screen updating off to speed up your macro code. You won't be able to see what the macro is doing, but it will run faster. Remember to set the ScreenUpdating property back to True when your macro ends. 

    • Application.ScreenUpdating = False 
    • Application.ScreenUpdating = True 

  2. Application.DisplayAlerts → The default value is True. Set this property to False to suppress prompts and alert messages while a macro is running; when a message requires a response, Microsoft Excel chooses the default response. If you set this property to False, Microsoft Excel sets this property to True when the code is finished, unless you are running cross-process code. 

    • Application.DisplayAlerts = False
    • Application.DisplayAlerts = True

  3. Application.AskToUpdateLinks → True if Microsoft Excel asks the user to update links when opening files with links. False if links are automatically updated with no dialog box.

    • Application.AskToUpdateLinks = False
    • Application.AskToUpdateLinks = True

  4. Application.CutCopyMode → Returns or sets the status of Cut or Copy mode. Can be True, False. Application.CutCopyMode = False clears the clipboard. Without that line you will get the warning 'There is a large amount of information on the Clipboard' when you close the workbook with a large amount of data on the clipboard.

    • Application.CutCopyMode = False
    • Application.CutCopyMode = True

  5. expression.Outline.ShowLevels → Displays the specified number of row and/or column levels of an outline.

    • ActiveSheet.Outline.ShowLevels RowLevels:=8, ColumnLevels:=8 ''' Expand all levels row and columns
    • ActiveSheet.Outline.ShowLevels RowLevels:=1, ColumnLevels:=1 ''' Collapse all levels row and columns

  6. expression .Hidden → Set this property to True to hide a row or column. The specified range must span an entire column or row.

    • Cells.EntireColumn.Hidden = False '''' Unhide all columns
    • Range("D:G,AF:AG,AJ:AO").EntireColumn.Hidden = True '''' Hide columns "D:G,AF:AG,AJ:AO"

    expression → A variable that represents a Range object.
    Option Explicit → Forces declaration of all variables in a module
    Option Private → Indicates that an entire module is Private
    On Error → Gives specific instructions for what to do in the case of an error
    Kill → Deletes a file

No comments:

Post a Comment