Hi there. I am working on a task list at work for multiple teams and sites. I have written a vba for hiding columns depending on the team name. On a separate spreadsheet, I have a code that changes the font name of a cell to Wingdings to allow for a tick to be shown when a task is completed (insisted upon by the finance manager).
However, when I try and use both codes separately, only the code for hiding columns works. Can you give me some tips?
Thanks,
Tom
However, when I try and use both codes separately, only the code for hiding columns works. Can you give me some tips?
Thanks,
Tom
Code:
Sub Worksheet_Calculate()
Dim theRange As Range, cell As Range
Set theRange = Range("K6:BL158")
For Each cell In theRange
Select Case cell
Case "ü":
cell.Font.Name = "Wingdings"
Case Else:
cell.Font.Name = "Calibri"
End Select
Next
End Sub
Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B2")) Is Nothing Then
Application.EnableEvents = False
If Target.Column = 2 And Target.Row = 2 And Target.Value = "Name1" Then
Application.Columns("K:BL").Select
Application.Selection.EntireColumn.Hidden = False
Application.Columns("K:AA").Select
Application.Selection.EntireColumn.Hidden = True
Application.Columns("AH:BL").Select
Application.Selection.EntireColumn.Hidden = True
End If
If Target.Column = 2 And Target.Row = 2 And Target.Value = "Name2" Then
Application.Columns("K:BL").Select
Application.Selection.EntireColumn.Hidden = False
Application.Columns("K:AP").Select
Application.Selection.EntireColumn.Hidden = True
Application.Columns("AY:BL").Select
Application.Selection.EntireColumn.Hidden = True
End If
If Target.Column = 2 And Target.Row = 2 And Target.Value = "Name3" Then
Application.Columns("K:BL").Select
Application.Selection.EntireColumn.Hidden = False
Application.Columns("K:BH").Select
Application.Selection.EntireColumn.Hidden = True
Application.Columns("BL").Select
Application.Selection.EntireColumn.Hidden = True
End If
If Target.Column = 2 And Target.Row = 2 And Target.Value = "Name4" Then
Application.Columns("K:BL").Select
Application.Selection.EntireColumn.Hidden = False
Application.Columns("U:BL").Select
Application.Selection.EntireColumn.Hidden = True
End If
If Target.Column = 2 And Target.Row = 2 And Target.Value = "Name5" Then
Application.Columns("K:BL").Select
Application.Selection.EntireColumn.Hidden = False
Application.Columns("K:BK").Select
Application.Selection.EntireColumn.Hidden = True
End If
If Target.Column = 2 And Target.Row = 2 And Target.Value = "Name6" Then
Application.Columns("K:BL").Select
Application.Selection.EntireColumn.Hidden = False
Application.Columns("K:AX").Select
Application.Selection.EntireColumn.Hidden = True
Application.Columns("BI:BL").Select
Application.Selection.EntireColumn.Hidden = True
End If
If Target.Column = 2 And Target.Row = 2 And Target.Value = "Name7" Then
Application.Columns("K:BL").Select
Application.Selection.EntireColumn.Hidden = False
Application.Columns("K:AG").Select
Application.Selection.EntireColumn.Hidden = True
Application.Columns("AQ:BL").Select
Application.Selection.EntireColumn.Hidden = True
End If
If Target.Column = 2 And Target.Row = 2 And Target.Value = "Name8" Then
Application.Columns("K:BL").Select
Application.Selection.EntireColumn.Hidden = False
Application.Columns("K:T").Select
Application.Selection.EntireColumn.Hidden = True
Application.Columns("AB:BL").Select
Application.Selection.EntireColumn.Hidden = True
End If
If Target.Column = 2 And Target.Row = 2 And Target.Value = "Show All" Then
Application.Columns("K:BL").Select
Application.Selection.EntireColumn.Hidden = False
End If
ActiveSheet.Range("F4").Select
End If
Application.EnableEvents = True
End Sub