How can I adapt these macros to reference the corresponding column names in Table4?
Code:
Private Sub ToggleButton1_Click()
[COLOR=#ff0000]' Reference a column named "Time"[/COLOR]
ActiveSheet.Columns(3).Hidden = Not (ToggleButton1.Value)
End Sub
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
[COLOR=#ff0000]' Reference a column named "ET"[/COLOR]
If Target.Cells.Count = 1 And Target.Column = 4 Then
ActiveSheet.Sort.SortFields.Clear
[COLOR=#ff0000]' Reference the second cell in a column named "NT"[/COLOR]
ActiveSheet.Sort.SortFields.Add Key:=Range("B2") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveSheet.Sort.SortFields.Add Key:=Range("A2") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
[COLOR=#ff0000]' Reference Table4[/COLOR]
With ActiveSheet.Sort
.SetRange Range("A:M")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End If
End Sub