Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50090

macro 2013

$
0
0
I am looking for help why the macro that I have for hiding cells based upon a number will not work in excel 2013. The third line If Not Intersect(target, Range("T1")) Is Nothing Then is where I am experiencing the error in the macro. If you have any ideas please let me know.

Code:

Private Sub worksheet_change(ByVal target As Range)
' range 1
If Not Intersect(target, Range("T1")) Is Nothing Then
  Rows("10:72").EntireRow.Hidden = False
    Select Case target
      Case 0
        Rows("10:72").EntireRow.Hidden = True
      Case 1
        Rows("10:65").EntireRow.Hidden = True
      Case 2
        Rows("10:57").EntireRow.Hidden = True
      Case 3
        Rows("10:48").EntireRow.Hidden = True
      Case 4
        Rows("10:40").EntireRow.Hidden = True
      Case 5
        Rows("10:32").EntireRow.Hidden = False
  End Select
 End If

' range 2
If Not Intersect(target, Range("T3")) Is Nothing Then
  Rows("84:116").EntireRow.Hidden = False
    Select Case target
      Case 0
        Rows("84:116").EntireRow.Hidden = True
      Case 1
        Rows("95:116").EntireRow.Hidden = True
      Case 2
        Rows("106:116").EntireRow.Hidden = True
      Case 3
        Rows("84:116").EntireRow.Hidden = False
  End Select
 End If
End Sub


Viewing all articles
Browse latest Browse all 50090

Trending Articles