I'm brand new to VBA and trying to learn variables. I have a simple piece of code that should set a variable to a range:
Sub Test()
Dim DataRange As Range
DataRange = Workbooks("Rooms.csv").Sheets(1).Range("A3", "AK17068")
End Sub
When I run I get Run-time error '91': Object variable or With block variable not set which.... isn't that what I did with the Dim statement? What is this referring to?
I saw in the MS docs that in certain cases (I don't fully understand when) I should use Option Strict On but when I try to use this I get a syntax error (Expected: Base or Compare or Explicit or Private). I think I am fundamentally misunderstanding how this should work (am C++ dev by training)