HI
I'm trying to merge data from 3 tabs into a new tab. For the first two tabs
it is correctly copying rows and pasting in new tab (alldefects) but for tab3 it is giving this error.
While debugging I could see that its selecting huge no. of rows instead of
only single row (as Tab3 has only 1 row for now).
Error is >>
Run-time error '1004'
The information cannot be pasted because the Copy area and the Paste area are
not the sa,e size and shape. Try one of the following.
** Click a single cell, and then paste.
** Select a rectangle that's the sa,e size and shape, and then paste.
Code for Tab3 (similar code is used for all three tabs) is >>
Query3sheet.Activate
' check if data is there to copy
if ActiveSheet.Range("A2") <> "" then
'select all rows with data till end
ActiveSheet.Range("A2").Select
ActiveSheet.Range(Selection, Selection.End(xlToRight)).Select
ActiveSheet.Range(Selection, Selection.End(xlDown)).Select
Selection.copy
AllDefectssheet.Activate
'get the last cell in this tab and paste....
LastCell = ActiveCell.SpecialCells(xlLastCell).Row
Range("A" + Trim(Str(LastCell+1))).Select
Activesheet.paste ' Error coming here.....
end if
I'm trying to merge data from 3 tabs into a new tab. For the first two tabs
it is correctly copying rows and pasting in new tab (alldefects) but for tab3 it is giving this error.
While debugging I could see that its selecting huge no. of rows instead of
only single row (as Tab3 has only 1 row for now).
Error is >>
Run-time error '1004'
The information cannot be pasted because the Copy area and the Paste area are
not the sa,e size and shape. Try one of the following.
** Click a single cell, and then paste.
** Select a rectangle that's the sa,e size and shape, and then paste.
Code for Tab3 (similar code is used for all three tabs) is >>
Query3sheet.Activate
' check if data is there to copy
if ActiveSheet.Range("A2") <> "" then
'select all rows with data till end
ActiveSheet.Range("A2").Select
ActiveSheet.Range(Selection, Selection.End(xlToRight)).Select
ActiveSheet.Range(Selection, Selection.End(xlDown)).Select
Selection.copy
AllDefectssheet.Activate
'get the last cell in this tab and paste....
LastCell = ActiveCell.SpecialCells(xlLastCell).Row
Range("A" + Trim(Str(LastCell+1))).Select
Activesheet.paste ' Error coming here.....
end if