I’m trying to use some code like this, and it’s failing:
data = Range("A1")
MsgBox data.Offset(1,1)
This seems like it should print the value of cell B2, but instead it gives me an error (Run-time error 424: Object required.).
So what data type does the expression Range("A1") return, and how do I declare data to be of the correct data type to store it?
Rangeis an object.That means you need use
setto assign an object reference:Background information: