What I have is an Excel spreadsheet that allows users to access some information about an item by typing in its associated part number. What has been requested is an additional feature that is an "Add to List" button. This button would take the item currently being viewed and add it to a separate workbook, the idea being that as users browse through information, it would automatically record the parts that they want to remember in a separate file.
In the sub for this button, what I am trying to do is to declare the target workbook to add the item to and assign it to a variable. Then, if an error occurs in that assignment, the workbook clearly does not exist and must be created. I thought this was the best way to create the file such that I didn't create a new one for each new item and such that I could reference it any time the button was called without having a global variable. I'm also perfectly open to other suggestions if this wasn't the best way to approach it.
My code thus far is below. The problem is that, as expected, an error occurs when I try to set listbook. However, instead of using that error to get into the for loop, it just throws a "Subscript out of range" error and stops the program. Clearly I am not understanding how to appropriately use the IsError function, and any help in implementing this would be greatly appreciated. Thanks.
Bookmarks