Hello,
I have a dropdown list which contains a list of dates. When I select a date from the list (e.g. 1/31/2011) I wish for only a selected amount of rows in the worksheet to be shown, and then everything else will be hidden.
Below I have what I have created so far in the macro, but it doesn't seem to work correctly. I eventually would like to have over 50 dates to choose from (with each date only showing the 150 rows that pertain to it).
Could someone take a look at this and let me know what needs to be changed? Thanks
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A3")) Is Nothing Then
With Range("A3")
Range("150:20000").EntireRow.Hidden = .Value = "1/31/2011"
Range("6:149,300:20000").EntireRow.Hidden = .Value = "2/28/2011"
Range("6:299,450:20000").EntireRow.Hidden = .Value = "3/31/2011"
End With
End If
End Sub
I have a dropdown list which contains a list of dates. When I select a date from the list (e.g. 1/31/2011) I wish for only a selected amount of rows in the worksheet to be shown, and then everything else will be hidden.
Below I have what I have created so far in the macro, but it doesn't seem to work correctly. I eventually would like to have over 50 dates to choose from (with each date only showing the 150 rows that pertain to it).
Could someone take a look at this and let me know what needs to be changed? Thanks
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A3")) Is Nothing Then
With Range("A3")
Range("150:20000").EntireRow.Hidden = .Value = "1/31/2011"
Range("6:149,300:20000").EntireRow.Hidden = .Value = "2/28/2011"
Range("6:299,450:20000").EntireRow.Hidden = .Value = "3/31/2011"
End With
End If
End Sub