![]() |
Run Time Error 1004
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 |
All times are GMT +1. The time now is 06:50 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com