hunter9002
New Member
- Joined
- Jun 1, 2012
- Messages
- 8
I am trying to write a code where I select the active cell's row on sheet1, copy the whole row, and then paste the information vertically starting at cell B5 on sheet3.
So far I have been able to select and copy the relevant row, but I am getting errors when I paste.
Here is what I have thus far:
Private Sub CommandButton1_Click()
Dim rngData As Range
Set rngData = Rows(ActiveCell.Row)
rngData.Copy ("Sheet3")
Range("B5").Select
rngData.PasteSpecial xlPasteValues: Transpose = True
Application.CutCopyMode = False
Me.UsedRange.Rows.AutoFit
End Sub
So far I have been able to select and copy the relevant row, but I am getting errors when I paste.
Here is what I have thus far:
Private Sub CommandButton1_Click()
Dim rngData As Range
Set rngData = Rows(ActiveCell.Row)
rngData.Copy ("Sheet3")
Range("B5").Select
rngData.PasteSpecial xlPasteValues: Transpose = True
Application.CutCopyMode = False
Me.UsedRange.Rows.AutoFit
End Sub
Last edited: