Can you please show us example and let me know why you want to do one column after columnI am new to VBA, I need a code for when I click a button the entire A column will be copied from sheet 1 and pasted in another sheet 'A' column and when I click the button again it should copy the same and paste it in B column. Can you please help me. Thanks
shuganth
Is that another sheet any know name or something?
With again click ... which column should be copied - A-column from sheet 1 or from another sheet A-column?
Like Consider that I have a sheet1 where the 'A' column has values , if I click a button it should paste in empty first column in sheet 2 and if I click the button again in sheet 1 the same 'A' column should get copied and pasted in sheet 2 's first empty column and the same as long as I press the button.Can you please show us example and let me know why you want to do one column after column
Sub Button2_Click()
Dim source As Worksheet
Dim destination As Worksheet
Dim emptyColumn As Long
Set source = Sheets("Sheet1")
Set destination = Sheets("Sheet2")
'find empty Column (actually cell in Row 1)'
emptyColumn = destination.Cells(1, destination.Columns.Count).End(xlToLeft).Column + 1
If destination.Cells(1, 1) = "" And emptyColumn = 2 Then emptyColumn = 1
source.Range("a1:a35").Copy destination.Cells(1, emptyColumn)
End Sub
Thank you very much vletm, this is perfect but I am facing one difficulty all the values which I copy from the column are the average of few columns so I'm getting #ref! can you please add the paste value to it when I try adding it its throwing me error and can you help me to add month on everytime when I click the button , Column 1 will have the month followed by the values that are to be pasted. Thank you very much this means a lot .