Hi Guys,
I am trying to create a command button that will copy a data range and paste this to the next empty column to the right when clicked. I need this to be able to work at least 10 times. I am newbie to VBA and macros. The code I was using is below;
Private Sub CommandButton21_Click()
Dim source As Worksheet
Dim destination As Worksheet
Dim emptyColumn As Long
Set source = Sheets("Sheet1")
Set destination = Sheets("Sheet1")
'find empty Column (actually cell in Row 3)'
emptyColumn =destination.Cells(3,8).End(xlToRight).Column
If empty Column > 1 Then
emptyColumn = emptyColumn + 1
End if
source.Range("B3:F76").Copy destination.Cells(3,emptyColumn)
End Sub
I think there is an issue with that last line? Please help!
Bookmarks