blossomthe2nd
Active Member
- Joined
- Oct 11, 2010
- Messages
- 450
Hi Guys
Much to the help of previous queries I wrote a VBA code that shows certain columns dependant on value in cell B1, see below :
My problem is , this is for a type of Form , so in the worksheet I have frozen the column header to row 2.
What I would like to happen is after the above columns have been hidden the curser will go to the next available row and (if possible ) move this row up directly beneath the frozen headers !!
Can anyone help ?
Much to the help of previous queries I wrote a VBA code that shows certain columns dependant on value in cell B1, see below :
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If InStr("out_of_course drawdowns customer_service", LCase(Range("B1").Value)) > 0 Then
Columns("C:G").EntireColumn.Hidden = True
Else
Columns("C:G").EntireColumn.Hidden = False
End If
If InStr("rollovers", LCase(Range("B1").Value)) > 0 Then
Columns("i:K").EntireColumn.Hidden = True
Else
Columns("i:K").EntireColumn.Hidden = False
End If
If InStr("out_of_course drawdowns rollovers", LCase(Range("B1").Value)) > 0 Then
Columns("L:N").EntireColumn.Hidden = True
Else
Columns("L:N").EntireColumn.Hidden = False
End If
If InStr("customer_service drawdowns rollovers", LCase(Range("B1").Value)) > 0 Then
Columns("O:q").EntireColumn.Hidden = True
Else
Columns("O:q").EntireColumn.Hidden = False
End If
If InStr("customer_service rollovers", LCase(Range("B1").Value)) > 0 Then
Columns("R").EntireColumn.Hidden = True
Else
Columns("R").EntireColumn.Hidden = False
End If
If InStr("customer_service rollovers out_of_course", LCase(Range("B1").Value)) > 0 Then
Columns("s:Z").EntireColumn.Hidden = True
Else
Columns("s:Z").EntireColumn.Hidden = False
End If
If InStr("rollovers drawdowns", LCase(Range("B1").Value)) > 0 Then
Columns("h").EntireColumn.Hidden = True
Else
Columns("h").EntireColumn.Hidden = False
End If
End Sub
My problem is , this is for a type of Form , so in the worksheet I have frozen the column header to row 2.
What I would like to happen is after the above columns have been hidden the curser will go to the next available row and (if possible ) move this row up directly beneath the frozen headers !!
Can anyone help ?