ParanoidAndroid
Board Regular
- Joined
- Jan 24, 2011
- Messages
- 50
Hi Guys
I would be most appreciative if someone could advise what is wrong with my code.
I want to cut from the 2nd row to the last used row in sheet1 and paste it into the first unused row in "master" sheet.
Then repeat the process with a different sheet (sheet2) into the master sheet.
Obviously im doing something wrong
I would be most appreciative if someone could advise what is wrong with my code.
I want to cut from the 2nd row to the last used row in sheet1 and paste it into the first unused row in "master" sheet.
Then repeat the process with a different sheet (sheet2) into the master sheet.
Obviously im doing something wrong
Code:
Dim LastRowMaster As Integer
Dim LastRow1 As Integer
Dim LastRow2 As Integer
' below - find the last used row for sheet 1 and 2, and first available row 'for Master sheet
LastRowMaster = Sheets("Master").Range("A65536").End(xlUp).Row + 1
LastRow1 = Sheets("1").Range("A65536").End(xlUp).Row
LastRow2 = Sheets("2").Range("A65536").End(xlUp).Row
'below - cut from row 2 until last used row in Sheet 2 and paste in first 'available row in Master sheet
Sheets("1").Range(2:LastRow1).Copy Destination:=Worksheets("Master").Range("LastRowMaster")
' below Re-determine first available row in Master sheet
LastRowMaster = Sheets("Master").Range("A65536").End(xlUp) + 1
'Copy row 2 until last used row in Sheet 2 and paste into first available 'row in master sheet
Sheets("2").Range("A2:LastRow2).Copy Destination:=Worksheets("Master").Range("LastRowMaster")