thunderhawk6630
New Member
- Joined
- Jun 26, 2019
- Messages
- 5
I have developed a Macro enabled workbook at work, and it has multiple sheets. I thought I had made it impossible to mess up, but a user was complaining about all the macros causing a 400 error message.
I asked for them to email me the file and sure enough the problem was on my machine too. A lot of Google searching was getting me nowhere. All the macro buttons I put on the sheet gave the same error. I opened up the editor and tried running them directly, same thing.
Here's what happened. In an effort to try to reduce errant entries by users, I have a majority of one of the worksheets protected. What the user had done was, inadvertently selected five sheets at the bottom. The macro was trying to run on multiple sheets, one of which was protected. I fired open a blank workbook to recreate the problem, thinking it was just selecting two sheets, but that wasn't it. The issue is selecting multiple workbooks, one of which had protection.
The real error was caused by trying to run a macro on a protected sheet, or on a protected cell. I was unaware that you can run macro's on multiple sheets at the same time by selecting multiple sheets (Control Click to select individual, or Shift Click to select groups), and then running the macro. Be extremely careful with this, and it is a good thing to be aware of.
But what I found to be most odd, was that if you select multiple sheets, save the file, and reopen the file, multiple sheets are still selected. So even when he emailed me the file, multiple sheets were still selected, giving me the same error. It was just chance that I noticed he had them selected, I could have gone mad chasing this down.
Hopefully this helps someone who is trying to chase down the error.
TL:DR - If you are getting a 400 error, first check to make sure that you don't have multiple sheets selected, your macro may be trying to run on multiple sheets and trying to run on a protected cell.
I asked for them to email me the file and sure enough the problem was on my machine too. A lot of Google searching was getting me nowhere. All the macro buttons I put on the sheet gave the same error. I opened up the editor and tried running them directly, same thing.
Here's what happened. In an effort to try to reduce errant entries by users, I have a majority of one of the worksheets protected. What the user had done was, inadvertently selected five sheets at the bottom. The macro was trying to run on multiple sheets, one of which was protected. I fired open a blank workbook to recreate the problem, thinking it was just selecting two sheets, but that wasn't it. The issue is selecting multiple workbooks, one of which had protection.
The real error was caused by trying to run a macro on a protected sheet, or on a protected cell. I was unaware that you can run macro's on multiple sheets at the same time by selecting multiple sheets (Control Click to select individual, or Shift Click to select groups), and then running the macro. Be extremely careful with this, and it is a good thing to be aware of.
But what I found to be most odd, was that if you select multiple sheets, save the file, and reopen the file, multiple sheets are still selected. So even when he emailed me the file, multiple sheets were still selected, giving me the same error. It was just chance that I noticed he had them selected, I could have gone mad chasing this down.
Hopefully this helps someone who is trying to chase down the error.
TL:DR - If you are getting a 400 error, first check to make sure that you don't have multiple sheets selected, your macro may be trying to run on multiple sheets and trying to run on a protected cell.