Grab the Free VBA Quick Reference Guide
www.chrisjterrell.com/excel-v...
In this video we go over how to create a range, worksheet, and workbook variable.
Specifically, we assingn the object using "Set". The technical details are less important than just knowing how to do it.
Code:
=======================
Sub PopularObjects()
'==========POPULAR OBJECTS =====================================
'NOTE Objects need to be set and you will get an error if you just use =
'Default = Nothing
Dim rng As Range
Set rng = ActiveCell
Dim ws As Worksheet
Set ws = ActiveSheet
Dim wb As Workbook
Set wb = ThisWorkbook
End Sub
Негізгі бет Creating a Excel VBA (Macro) Range, Worksheet, or Workbook Variable
Пікірлер: 5