AndyTampa
Board Regular
- Joined
- Aug 14, 2011
- Messages
- 186
- Office Version
- 365
- 2016
- Platform
- Windows
This macro is supposed to refresh a worksheet that already exists. I'm trying to error check before deleting the existing data and replacing it with new data.
I'm creating a new temporary sheet and scraping a table from a webpage. If the scrape fails, I want to delete the new sheet and display a message box., and not continue. I tried an IF Error, but it always errored. I can't find how to do "On Error, do this and this and this."
If there is no error, I want to delete the existing worksheet and rename the new worksheet. I'm familiar with adding/deleting/renaming worksheets, but it's the error handling I'm having difficulty with.
The other thing is whether there is an error or not, once it's done with the related actions, I need to end the macro. Putting EndIf in the Then or Else part of an If loop caused an issue when I tried it.
I'm creating a new temporary sheet and scraping a table from a webpage. If the scrape fails, I want to delete the new sheet and display a message box., and not continue. I tried an IF Error, but it always errored. I can't find how to do "On Error, do this and this and this."
If there is no error, I want to delete the existing worksheet and rename the new worksheet. I'm familiar with adding/deleting/renaming worksheets, but it's the error handling I'm having difficulty with.
The other thing is whether there is an error or not, once it's done with the related actions, I need to end the macro. Putting EndIf in the Then or Else part of an If loop caused an issue when I tried it.