Excel VBA: Setting a range to an object variable?
Imagine assigning the following range area to a variable: (A16:I19, G20, I20). The first argument is a rectangular block of data, followed by two cells hanging below it. I want all three sections to be assigned/defined to an object variable. The following code doesn't have to go to the cells above. The cells above represents the idea of what type of range I am seeking to assign to an object variable.
Set laborArea = Sheets(1).Range("findRate.Offset(1, -4).Address & ":" & totalAmount.Offset(-1, 0).Address, totalHours.Address, totalAmount.Address)
However I am getting an object defined error. Any idea what I'm doing wrong?
I tried your suggestion. Then to test it, I tried to mark it as bold so that I can see if it was recognized properly. On the following line I received a 438 error message, stating "Object support this property or method." Here is the line where the error occurs:
Sheets(1).laborArea.Font.Bold = True
Additionally, since I want a contiguous block between findRate.Offset(1, -4) and totalAmount.Offset(-1, 0) shouldn't there be something like &":"& between them instead of a comma?
