Tutorial by Examples: activeworkbook

Option Explicit Sub LoopAllSheets() Dim sht As Excel.Worksheet ' declare an array of type String without committing to maximum number of members Dim sht_Name() As String Dim i As Integer ' get the number of worksheets in Active Workbook , and put it as the maximum number of members in t...
It's a VBA Best Practice to always specify which workbook your VBA code refers. If this specification is omitted, then VBA assumes the code is directed at the currently active workbook (ActiveWorkbook). '--- the currently active workbook (and worksheet) is implied Range("A1").value = 3.1...
ActiveWorkbook and ThisWorkbook sometimes get used interchangeably by new users of VBA without fully understanding which each object relates to, this can cause undesired behaviour at run-time. Both of these objects belong to the Application Object The ActiveWorkbook object refers to the workbook ...

Page 1 of 1