Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear Al
I have Macro Which Copy from all sheet and paste in last sheet.I already used this and working fine. Now I was trying to use same macro for another sheet but there I am Getting following error RunTime Error 1004 Select method or worksheet class failed. Pleasefind code below. Sub CopyAll() Application.ScreenUpdating = False Dim cnt As Long Dim r As Range For i = 1 To Sheets.count - 1 If Sheets(i).Name < "Data" Then Sheets(i).Select (On debug error shows on this line) SN = ActiveSheet.Name Set r = Range("a21:s38") cnt = r.Rows.count - 2 r.Copy Sheets("Data").Select Range("XFD1").End(xlToLeft).Offset(0, 1).Select ActiveSheet.Paste 'ActiveCell.EntireRow.Delete Set r = Range("M65000").End(xlUp).Offset(1, 0) r.Select Range(Selection, Selection.Offset(cnt, 0)).Value = SN 'Range("P1").Value = SN End If Next i Application.ScreenUpdating = True End Sub Please help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
run time error 1004 general odbc error excel 2003 vba | Excel Programming | |||
Run Time Error 1004: Application or Object Defined Error | Excel Programming | |||
Run Time 1004 Error: Application or Object Difine Error | Excel Programming | |||
run-time error '1004': Application-defined or object-deifined error | Excel Programming | |||
Run time error 1004 General ODCB Error | Excel Programming |