Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
HI I am very new to VBA and i have done the code below where it transfers selected cells into another sheet into cells i have designated from a 'add' button, what i cant do is automatically add a new line when the 'add' button has been clicked on.
Pleased can you help with the code below so it will auto goto new line when add button is clicked
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Sheets("Northants").Range("B22:B22").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("A2:A2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B23:B23").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("B2:B2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B24:B24").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("C2:C2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B25:B25").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("D2:D2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B26:B26").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("E2:E2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B27:B27").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("F2:F2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B28:B28").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("G2:G2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B29:B29").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("H2:H2").Select
ActiveSheet.Paste
Sheets("Northants").Range("C29:C29").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("I2:I2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B30:B30").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("J2:J2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B31:B31").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("K2:K2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Pleased can you help with the code below so it will auto goto new line when add button is clicked
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Sheets("Northants").Range("B22:B22").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("A2:A2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B23:B23").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("B2:B2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B24:B24").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("C2:C2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B25:B25").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("D2:D2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B26:B26").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("E2:E2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B27:B27").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("F2:F2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B28:B28").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("G2:G2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B29:B29").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("H2:H2").Select
ActiveSheet.Paste
Sheets("Northants").Range("C29:C29").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("I2:I2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B30:B30").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("J2:J2").Select
ActiveSheet.Paste
Sheets("Northants").Range("B31:B31").Copy
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("K2:K2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub