blossomthe2nd
Active Member
- Joined
- Oct 11, 2010
- Messages
- 450
Hi Guys,
I have a worksheet , where from a drop down in Cell B2, a mcro runs hiding certain columns and formats sheet, see code below.
As this is a Shared workbook with multiple users, I would like to add the function that after B2 is selected the file Autosaves -- Is there a code for this ?
I have a worksheet , where from a drop down in Cell B2, a mcro runs hiding certain columns and formats sheet, see code below.
As this is a Shared workbook with multiple users, I would like to add the function that after B2 is selected the file Autosaves -- Is there a code for this ?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$B$1" Then Exit Sub
Dim LR As Long
If InStr("out_of_course drawdowns customer_service", LCase(Target.Value)) > 0 Then
Columns("C:G").EntireColumn.Hidden = True
Else
Columns("C:G").EntireColumn.Hidden = False
End If
If InStr("rollovers", LCase(Target.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(Target.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(Target.Value)) > 0 Then
Columns("O:q").EntireColumn.Hidden = True
Else
Columns("O:q").EntireColumn.Hidden = False
End If
If InStr("customer_service rollovers", LCase(Target.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(Target.Value)) > 0 Then
Columns("s:Z").EntireColumn.Hidden = True
Else
Columns("s:Z").EntireColumn.Hidden = False
End If
If InStr("rollovers drawdowns", LCase(Target.Value)) > 0 Then
Columns("h").EntireColumn.Hidden = True
Else
Columns("h").EntireColumn.Hidden = False
End If
LR = Range("A" & Rows.Count).End(xlUp).Row + 1
Application.Goto Range("A" & LR), True
End Sub