Originally Posted by
6StringJazzer
You have several Subs in that module. Specifically what steps do you take to invoke the macro that causes the problem? I did not have any problems upon opening the file, with macros enabled, and I don't know what to do next to reproduce your problem.
In Sub
Unhide_Workbook, variable
LastWsName is undefined. That is probably not the problem but I strongly recommend to everyone that they
declare variables. Doing so prevents a lot of bugs and runtime errors.
Thanks for taking a look and sorry about the confusion. I separated out the problematic group of macros into a separate module called "ERROR_MACRO" and put the code below for reference, added annotations and reattached the file. The functionality looks something like this:
1. Disable_Workbook_Input_Messages() - Cycle through each worksheet in a workbook and run the Disable_Workbook_Input_Messages() macro
2. Disable_Worksheet_Input_Messages() - Select the used range on a worksheet, determine if each cell has validation via the HasValidation() function and turn off the "Input Messages" if it does
3. HasValidation(Cell As Range) As Boolean - Check if a cell has validation, if so then return a value of true.
Note that there are also enable versions of the macros that function the same way.
The error specifically happens when the Disable_Worksheet_Input_Messages() or Enable_Worksheet_Input_Messages() macros goes to run on "Sheet3 (2. Issue-Task Log)". Part way through selecting each cell with validation and disabling/enabling the input message I get
"Run-time error '1004'
Application-defined or object-defined error"
and it highlights the code line "c.Validation.ShowInput = False" which to me is saying it has recognized a cell has validation via the previous (If HasValidation(c) Then) but then when it goes to enable/disable the input message it doesn't recognize the cell reference?
I have tried undoing all merged cells, changing the table to a range, deleting each row and running the macro to determine if it is a specific cell causing the issue. Nothing seems to work. The oddest part is it doesn't seem to consistently choose a specific cell to error out on. It seems to change. Thanks again for the help.
DISABLE/ENABLE INPUT MESSAGES IN WORKBOOK CODE (Errors highlighted in red)
Bookmarks