If cell value changes and equal to your specific choice a macro will run
Sub worksheet_change(ByVal target As Range)
Set target = Range("I6")
If target.Value = "1 AM" Then
Rows("7:55").EntireRow.Hidden = False
Call t1
End If
End sub
------------------------------------------------------------------------------------
Sub worksheet_change(ByVal target As Range)
Set target = Range("I6")
Call sbUnProtectSheet
If target.Value = "1 AM" Then
Rows("7:55").EntireRow.Hidden = False
Call t1
End If
If target.Value = "2 AM" Then
Rows("7:55").EntireRow.Hidden = False
Call t2
Rows("54:55").EntireRow.Hidden = True
Rows("57:65536").EntireRow.Hidden = True
End If
If target.Value = "3 AM" Then
Rows("7:55").EntireRow.Hidden = False
Call t3
Rows("52:55").EntireRow.Hidden = True
Rows("57:65536").EntireRow.Hidden = True
End If
If target.Value = "4 AM" Then
Rows("7:55").EntireRow.Hidden = False
Call t4
Rows("50:55").EntireRow.Hidden = True
Rows("57:65536").EntireRow.Hidden = True
End If
If target.Value = "5 AM" Then
Rows("7:55").EntireRow.Hidden = False
Call t5
Rows("48:55").EntireRow.Hidden = True
Rows("57:65536").EntireRow.Hidden = True
End If
If target.Value = "6 AM" Then
Rows("7:55").EntireRow.Hidden = False
Call t6
Rows("46:55").EntireRow.Hidden = True
Rows("57:65536").EntireRow.Hidden = True
End If
If target.Value = "7 AM" Then
Rows("7:55").EntireRow.Hidden = False
Call t7
Rows("44:55").EntireRow.Hidden = True
Rows("57:65536").EntireRow.Hidden = True
End If
If target.Value = "8 AM" Then
Rows("7:55").EntireRow.Hidden = False
Call t8
Rows("42:55").EntireRow.Hidden = True
Rows("57:65536").EntireRow.Hidden = True
End If
If target.Value = "9 AM" Then
Rows("7:55").EntireRow.Hidden = False
Call t9
Rows("40:55").EntireRow.Hidden = True
Rows("57:65536").EntireRow.Hidden = True
End If
If target.Value = "10 AM" Then
Rows("7:55").EntireRow.Hidden = False
Call t10
Rows("38:55").EntireRow.Hidden = True
Rows("57:65536").EntireRow.Hidden = True
End If
If target.Value = "11 AM" Then
Rows("7:55").EntireRow.Hidden = False
Call t11
Rows("36:55").EntireRow.Hidden = True
Rows("57:65536").EntireRow.Hidden = True
End If
If target.Value = "12 PM" Then
Rows("7:55").EntireRow.Hidden = False
Call t12
Rows("34:55").EntireRow.Hidden = True
Rows("57:65536").EntireRow.Hidden = True
End If
Call sbProtectSheet
End Sub
Sub sbProtectSheet()
Sheets("PCS").Protect "rsadmin", True, True
End Sub
Sub sbUnProtectSheet()
Sheets("PCS").Unprotect "rsadmin"
End Sub
No comments:
Post a Comment