I have a multiple selection, Option buttons, that change the value of cell D7 from 1 to 5, depending on choice. I want to unhide rows 16 to 26 if value is 1 and hide them if it's different, and so on for every other value.
But I can't even get this to work at all, and I'm not sure what I'm doing wrong.
Update: If I change the cell value, nothing happens, but if I delete all contents and add a value it gives: "Argument not optional", and it highlights this part of the code for me:
Private Sub Worksheet_Change(ByVal Target as Excel.Range) Thank you
Private Sub Worksheet_Change(ByVal Target As Excel.Range) If IsNumeric(Target) And Target.Address = "$D$7" Then Select Case Target.Value Case 0 To 90: Cell_Hider End Select End If End Sub Sub Cell_Hider(ByVal Target As Range) If Range("$D$7").Value = "1" Then Rows("16:26").EntireRow.Hidden = False Else Rows("16:26").EntireRow.Hidden = True End If End Sub
Worksheet_Changenever excecuted as it should immediately throw an error. Make sure the event code is placed in the correct worksheet (the one you change a value at). Also make sure you have events enabledApplication.EnableEventsmust not be false.