I have a new problem with the same code so have started a new thread. (Hope this is O.K. moderators?)
My code is conditionally opening spreadsheets in a folder, pulling information from certain cells and putting them in a master spreadsheet.
When it comes across a spreadsheet that has been digitally signed I get the error message-
Copy method of range class failed
The debugger points at this line:![]()
Option Explicit Sub nicksmacro() Dim C As Long Dim Cell As Range Dim DstRng As Range Dim MyDir, FN As String Dim LR As Long Dim SrcRng As Range Application.ScreenUpdating = False 'Runtime MyDir = "\\C:\Test Folder\" Set DstRng = ThisWorkbook.Sheets("Sheet1").Range("A2") Set DstRng = DstRng.Resize(RowSize:=DstRng.Parent.UsedRange.Rows.Count) FN = Dir(MyDir & "*Summary*.xls") Do While FN <> "" If FN <> ThisWorkbook.Name Then With Workbooks.Open(MyDir & FN) Set SrcRng = .Sheets("Sheet1").Range("E3,c22,c23,c24,c25") For Each Cell In SrcRng.Cells Cell.Copy DstRng.Offset(LR, C) C = C + 1 Next Cell .Close False C = 0 LR = LR + 1 End With End If FN = Dir() Loop Application.ScreenUpdating = True End Sub
Cell.Copy DstRng.Offset(LR, C)
Is there a way to stop this happening?











LinkBack URL
About LinkBacks
Register To Reply

Bookmarks