Hi Team ,
Basically i need to copy the rows and cols which are not fixed, so it can increase daily from one sheet to another sheet in the same workbook.
I am getting error in the end as "Run-time error '5' Invalid procedure call or argument, can you please help.
Below is the vba code:
Sub consolidate()
Dim wb As Workbook
Set wb = ThisWorkbook
Dim wsAll As Worksheet
Set wsAll = wb.Worksheets("All")
Dim ws1 As Worksheet
Set ws1 = wb.Worksheets("S1")
Dim lastRowAll As Long
Dim lastRow1 As Long
Dim lastCol1 As Long
lastRowAll = wsAll.Cells(wsAll.Rows.Count, "A").End(xlUp).Row + 1
lastRow1 = ws1.Range("A1").End(xlDown).Row
lastCol1 = ws1.Range("A1").End(xlToRight).Column
ws1.Activate
Cells(lastRow1, lastCol1).Copy
wsAll.Activate
ActiveSheet.Cells("A" & lastRowAll).Select
Application.CutCopyMode = False
MsgBox ("Job Complete!!")
End Sub
Thanks,
SK
Basically i need to copy the rows and cols which are not fixed, so it can increase daily from one sheet to another sheet in the same workbook.
I am getting error in the end as "Run-time error '5' Invalid procedure call or argument, can you please help.
Below is the vba code:
Sub consolidate()
Dim wb As Workbook
Set wb = ThisWorkbook
Dim wsAll As Worksheet
Set wsAll = wb.Worksheets("All")
Dim ws1 As Worksheet
Set ws1 = wb.Worksheets("S1")
Dim lastRowAll As Long
Dim lastRow1 As Long
Dim lastCol1 As Long
lastRowAll = wsAll.Cells(wsAll.Rows.Count, "A").End(xlUp).Row + 1
lastRow1 = ws1.Range("A1").End(xlDown).Row
lastCol1 = ws1.Range("A1").End(xlToRight).Column
ws1.Activate
Cells(lastRow1, lastCol1).Copy
wsAll.Activate
ActiveSheet.Cells("A" & lastRowAll).Select
Application.CutCopyMode = False
MsgBox ("Job Complete!!")
End Sub
Thanks,
SK