It’s pretty easy to cut and paste from a macro. Here are a few examples. The code works identical for copy, just replace the word cut with copy!
This one cuts and pastes a single cell, a1 over to b1:
Sub OneCell()
Range("A1").Select
Selection.Cut
Range("B1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
This one cuts and pastes an entire column, A over to B:
Sub OneColumn()
Range("A:A").Select
Selection.Cut
Range("B:B").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
This one cuts and pastes an entire row, 1 over to 2:
Sub OneRow()
Range("1:1").Select
Selection.Cut
Range("2:2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
October 17th, 2008 at 8:46 am
How do you paste it into specific cells in another worksheet?
March 30th, 2009 at 4:25 pm
From VBA help:
Worksheets(”Sheet1″).Range(”A1:D4″).Copy _
Destination:=Worksheets(”Sheet2″).Range(”E5″)
Now I understand
June 1st, 2009 at 11:19 am
Hi,
Could you please help-me in this situation…
How to make this function work?
I just need to call it in a cell like “=test_copy(B1)” to see it copied into B2
I am new to vba, but I’m able to do some perl,c++
regards,
Marcelo
Public Function test_copy(Var01 As Range)
Var01.Select
Selection.Copy
Range(”B2″).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Function
June 10th, 2009 at 9:52 pm
Is there a way to cut a row/rows and insert it/them into a sorted order on a different page with other information? I can’t just insert them at the bottom and sort because the rows on the other page are merged and cannot be sorted. This is the last piece to my VBA puzzle. Thank you!