rhombus4
Well-known Member
- Joined
- May 26, 2010
- Messages
- 586
- Office Version
- 365
- 2016
- Platform
- Windows
I have a macro in sheet1 which when pressed will transfer data into sheet 2. What I need it to do is look in row 2 to see if it contains anything and if blank then copy to row 2.
If row 2 is full then transfer to row 3 and so on.
In Sheet 1 I have the below in cells A1:A4 and I enter data in cells B2:B4
Name
Age
Nationality
Sex
In Sheet 2 the headings are across Row 1
NAme Age Nationality Sex
Not sure what to add to the macro so it will check to see if the row is empty or not
The Macro I currently have is :
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 29/06/2011 by browgins
'
'
Range("B1").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A2").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("B2").Select
Selection.Copy
Sheets("Sheet2").Select
Range("B2").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("B3").Select
Selection.Copy
Sheets("Sheet2").Select
Range("C2").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("B4").Select
Selection.Copy
Sheets("Sheet2").Select
Range("D2").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("B1").Select
End Sub
If row 2 is full then transfer to row 3 and so on.
In Sheet 1 I have the below in cells A1:A4 and I enter data in cells B2:B4
Name
Age
Nationality
Sex
In Sheet 2 the headings are across Row 1
NAme Age Nationality Sex
Not sure what to add to the macro so it will check to see if the row is empty or not
The Macro I currently have is :
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 29/06/2011 by browgins
'
'
Range("B1").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A2").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("B2").Select
Selection.Copy
Sheets("Sheet2").Select
Range("B2").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("B3").Select
Selection.Copy
Sheets("Sheet2").Select
Range("C2").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("B4").Select
Selection.Copy
Sheets("Sheet2").Select
Range("D2").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("B1").Select
End Sub