Reputation: 89
I get the "Subscript out of range" error from the line below:
Set WBset = Workbooks("FilePath\PK18 - Unformatted.xls").Worksheets("PK18 - Unformatted")
I checked the sheet name and the filename and they are correct. The sheet exists.
Upvotes: 0
Views: 123
Reputation: 511
Presuming WBset is a Workbook Object, you need to remove the file path from the command so it looks like the following. The file needs to be open as Workbooks is a collection of the Workbook objects open.
Set WBset = Workbooks("PK18 - Unformatted.xls").Worksheets("PK18 - Unformatted")
Upvotes: 1