PDA

View Full Version : [SOLVED:] Copy Macro based on ActiveCell.Offset(r,c)



cboshdave
05-02-2023, 07:04 AM
I'm trying to create a simple macro to adjust the positions of cells. I don't understand why the Copies and Select work, but the Paste or PasteSpecial don't work? The Paste gives me a Run-time error '438': Object doesn't support this property or method
The PasteSpecial throws Run-time error '1004': PasteSpecial method of Range class failed


Sub CopyAcross()
ActiveCell.Offset(1, 0).Cut
ActiveCell.Offset(-1, 1).Paste 'or PasteSpecial xlPasteAll
ActiveCell.Offset(2, 0).Cut
ActiveCell.Offset(0, 2).Paste
ActiveCell.Offset(3, 0).Select 'Move to the next section
End Sub

I was just trying to keep it simple. Apparently, it can't be that simple?

georgiboy
05-02-2023, 07:27 AM
Maybe this will help:

Sub CopyAcross()
With ActiveCell
.Offset(1, 0).Cut .Offset(-1, 1)
.Offset(2, 0).Cut .Offset(0, 2)
End With
End Sub

cboshdave
05-02-2023, 10:44 AM
Maybe this will help:

Sub CopyAcross()
With ActiveCell
.Offset(1, 0).Cut .Offset(-1, 1)
.Offset(2, 0).Cut .Offset(0, 2)
End With
End Sub

Thanks. That is the answer. I search all over and could not find that. I'm off and running!