Hi
I know how to select a block of cells using VBA.
But for this task, I have to be able to do it using the offset function, because data is inserted using the offset function.
So my question is this: in the code below, assuming that C3 (or C4, or C5 (depending on where the offset function ended up) is the last cell that the code went to, does anyone know how to highlight the three cells to the left, including C3 (or C4, or C5).
So if C3 was the last cell, C3, B3, and A3 would be highlithed and copied.
The code in my line below copies C3, B3, and A3, but I'd like to do it using the active cell and offset functions.
Can someone please advise?
I know how to select a block of cells using VBA.
But for this task, I have to be able to do it using the offset function, because data is inserted using the offset function.
So my question is this: in the code below, assuming that C3 (or C4, or C5 (depending on where the offset function ended up) is the last cell that the code went to, does anyone know how to highlight the three cells to the left, including C3 (or C4, or C5).
So if C3 was the last cell, C3, B3, and A3 would be highlithed and copied.
The code in my line below copies C3, B3, and A3, but I'd like to do it using the active cell and offset functions.
Can someone please advise?
Code:
Sub HighlightCells()
'ActiveCell.Offset(0, -2).Select
Range("C3", Range("C3").End(xlToLeft)).Copy
End Sub