Hello. I am new to VBA. I have looked and looked and tried to use Excel Help from Microsoft, but can't seem to get something to work.
I want to have a message box pop up with yes and no questions once a cell has a value on it. But once that value is entered, I would like it to look at previous cells to see what code to run to unhide rows. I had a macro set up to unhide rows based on a button the user would click, but I would like to have a box pop up and have the user select Yes to run macro instead of user selecting it. But depending on a previous cell, it could run a different macro.
here is a snippet of my code:
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$C$44"
ActiveSheet.Unprotect "precert"
If Target.Value = "IND" Then Rows("48:52").EntireRow.Hidden = True
If Target.Value = "IND" Then Rows("60").EntireRow.Hidden = True
If Target.Value = "IND" Then Rows("85:90").EntireRow.Hidden = True
If Target.Value = "IND" Then Rows("80:85").EntireRow.Hidden = False
If Target.Value = "IND" Then Rows("67").EntireRow.Hidden = False
If Target.Value = "DEP" Then Rows("67").EntireRow.Hidden = True
If Target.Value = "DEP" Then Rows("80:85").EntireRow.Hidden = True
If Target.Value = "DEP" Then Rows("60").EntireRow.Hidden = False
If Target.Value = "DEP" Then Rows("85:90").EntireRow.Hidden = False
Case "$C$70"
If Target.Value = "N" Then Rows("75").EntireRow.Hidden = True
If Target.Value = "N" Then Rows("80:90").EntireRow.Hidden = True
If Target.Value = "N" Then MsgBox "Are there docs submitted that you have to verify?", vbYesNo, "IMPORTANT"
If vbYes Then UnhideInfoEXP
Display More
Where UnhideinfoEXP is the macro that basically unhides row 60 and 48-52. This coding works, except when I click No, it still runs the macro.
Also, if the answer is to the pop up is Yes, I would like it to look at cell 44 to see if it says DEP, and if so to also to unhide row 67, if not only unhide those listed.
I guess I can start with the yes and no button to decide if things should be hidden or not, but I am not familar with changing a popup message to have Yes/No and have the Yes result action depend on a different cell value as what action to unhide while the NO action would basically hide rows 80-90
Please bare with me as I can not post my workbook to the forum, and if I am unclear, I am also sorry.
David