I'm new to VBA coding (I mostly work with R) and I am having trouble writing a macro to copy and paste. Specifically, I can do the first command fine, but when I go to the next row to do the same thing, it reverts back to the initial cell.
Here's the code that I'm working with:
Keyboard Shortcut: Ctrl+h
Range("B2").Copy Range("C1")
Range("B4").Copy Range("C3")
Range("B6").Copy Range("C5")
And so on... This does exactly what I want it to do, but I was wondering if there is a way to generalize it so that I can highlight the first cell of each "block" that I wish to do this to (i.e., A1,A2,B1,B2,C1,C2 etc.) and just use the keyboard shortcut. I got it to work partially using:
Sub Format()
' Format Macro
' Keyboard Shortcut: Ctrl+h
Selection.Cut
ActiveCell.Offset(-1, 1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, -1).Range("A1").Select
Selection.EntireRow.Delete
End Sub
But that always reverts back to the initial cell (A1 in this case) once I move on to the next block.
Thanks for your help!