I'm trying to make a sales quotation entry process simpler by using macros. This code below works, but it goes horizontally across the sheet instead of going vertically down the columns.
I have dynamic data (from vlookup) generated in cell G3 and I've made a button to copy this data from G3 and paste the value to column A1. As of now, upon clicking the assigned macro button, it pastes data from, G3 to H3, I3, J3, K3 and so on. I need the macro to copy-paste from G3 to the cell directly below, like A1, A2, A3, A4 and so on...
I have dynamic data (from vlookup) generated in cell G3 and I've made a button to copy this data from G3 and paste the value to column A1. As of now, upon clicking the assigned macro button, it pastes data from, G3 to H3, I3, J3, K3 and so on. I need the macro to copy-paste from G3 to the cell directly below, like A1, A2, A3, A4 and so on...
Code:
Sub paste2()
' paste2 Macro
Dim lastCol As Long
' this finds the number of the last column
lastCol = Cells(3, Columns.Count).End(xlToLeft).Column
Range("G3").Copy
Range("A1").Select
Cells(3, lastCol + 1).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub