B
Brian Matlack
Hi!
I want to automatically hide columns on a sheet based on the users
selection of a start date and end date. The user selects a date from a
data validation dropdown list and then a vlookup formula puts the
corrisponding column letter in cells B3 and C3 of the sheet named "Hide
Columns" This is what I have but it keeps giving me an error "Type
Mismatch".
<start code>
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim choice1 As String
Dim choice2 As String
choice1 = Worksheets("Hide Columns").Cells(3, 2)
choice2 = Worksheets("Hide Columns").Cells(3, 3)
On Error GoTo ErrHandler
If choice1 = "" Or choice2 = "" Then
End
Else
Columns("choice1:choice2").Select
Selection.EntireColumn.Hidden = True
Range("A1").Select
End If
ErrHandler:
End Sub
<end code>
Any help would be greatly appreciated. Thanks for your time!!
I want to automatically hide columns on a sheet based on the users
selection of a start date and end date. The user selects a date from a
data validation dropdown list and then a vlookup formula puts the
corrisponding column letter in cells B3 and C3 of the sheet named "Hide
Columns" This is what I have but it keeps giving me an error "Type
Mismatch".
<start code>
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim choice1 As String
Dim choice2 As String
choice1 = Worksheets("Hide Columns").Cells(3, 2)
choice2 = Worksheets("Hide Columns").Cells(3, 3)
On Error GoTo ErrHandler
If choice1 = "" Or choice2 = "" Then
End
Else
Columns("choice1:choice2").Select
Selection.EntireColumn.Hidden = True
Range("A1").Select
End If
ErrHandler:
End Sub
<end code>
Any help would be greatly appreciated. Thanks for your time!!