Hello,
I am trying to get some code working where I can copy worksheets from one workbook into another based on a list. Here is the code i have put together so far:
Dim Sht As Worksheet
Dim sheet_names As Variant
Dim destWB As Workbook
Set destWB = ThisWorkbook
sheet_names = OpenBook.Sheets("CaseList").Range("C2:C2000").Value
For Each Sht In OpenBook.Sheets
If Not IsError(Application.Match(Sht.Name, sheet_names, 0)) Then
Sht.Copy After:=destWB.Sheets(Sheets.Count)
End If
Next Sht
When i run the code, i get a runtime error 424 message. Any help would be appreciated.
Thanks
I am trying to get some code working where I can copy worksheets from one workbook into another based on a list. Here is the code i have put together so far:
Dim Sht As Worksheet
Dim sheet_names As Variant
Dim destWB As Workbook
Set destWB = ThisWorkbook
sheet_names = OpenBook.Sheets("CaseList").Range("C2:C2000").Value
For Each Sht In OpenBook.Sheets
If Not IsError(Application.Match(Sht.Name, sheet_names, 0)) Then
Sht.Copy After:=destWB.Sheets(Sheets.Count)
End If
Next Sht
When i run the code, i get a runtime error 424 message. Any help would be appreciated.
Thanks