Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like help writing some code that would run the code below if the
value of cell a5 is the word "Fixed". Rows("5:13").Select Selection.EntireRow.Hidden = True |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub Worksheet_Change(ByVal Target As Range)
' Target = the cell/range just changed. If Target.Address = "$A$5" Then Select Case UCase(Target) Case "FIXED" ActiveSheet.Rows("6:10").EntireRow.Hidden = True Case "BROKEN" ActiveSheet.Rows("11:15").EntireRow.Hidden = True Case "REPAIR" ActiveSheet.Rows("16:20").EntireRow.Hidden = True Case "RESTORE" ActiveSheet.UsedRange.Rows.EntireRow.Hidden = False Case Else 'Do nothing End Select End If End Sub HTH, "hshayhorn" wrote in message ... That worked great. I'd like to add one more thing to the mix if I could. I need this code to run as the user tabs off the A5 cell. so basically they'll enter a value in A5. Then when they go to the next entry cell the code runs and the other rows are hidden if the value is fixed. Then, I'd also like to add two more If to this statement. so, If A5=fixed run this code or if A5=Broken run that code or if A5=repair then run the other code... All of the code by the way hides rows it just all hides different rows based on the vales. So, can I use an ElseIF statement? "JLGWhiz" wrote: Sub hahaMacro() If LCase(ActiveSheet.Range("A5").Value) = "fixed" Then Rows("5:13").Select Selection.EntireRow.Hidden = True End If End Sub "hshayhorn" wrote: I would like help writing some code that would run the code below if the value of cell a5 is the word "Fixed". Rows("5:13").Select Selection.EntireRow.Hidden = True |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF statement inside a SUMIF statement.... or alternative method | Excel Worksheet Functions | |||
Reconcile Bank statement & Credit card statement & accounting data | Excel Worksheet Functions | |||
Embedding an OR statement in an IF statement efficiently | Excel Discussion (Misc queries) | |||
Can an If statement answer an If statement? | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions |