Why doesn't the red line work? I'm trying to set cell range coordinates to variables for easier maintenance in the future in case rows/columns shift using VBA in Excel. This way I can change the variable values in one place instead of scattered throughout the code. There is a lot more to all of this but that is the line I'm having trouble with, I eventually copy the range data to another sheet in specific cells different.
I can do one cell using
but I would like to copy a whole range.
Code:
Dim CellsDown1 as Integer, CellsAcross2a as Integer
Dim CellsAcross2b as Integer
Dim Rng2Data as Range
CellsDown1 = 13
CellsAcross2a = 5
CellsAcross2b = 10
[b][COLOR=red]Set Rng2Data = Sheets("Data").Range(Cells(CellsDown1, CellsAcross2a), _ Cells(CellsDown1, CellsAcross2b))[/color][/b]
I can do one cell using
Code:
Set Rng1Data = Sheets("Data").Cells(CellsDown1, CellsAcross1a)
but I would like to copy a whole range.