Hi! I have the following code on a sheet, this is a heavy workbook and I'm worried if its continuously running with every click it will slow down the user. How can I modify this to run only on the first click on the ActiveWorksheet, or so i can assign it to a button to be only run when clicked.
Any help would greatly be appreciated! Thank you
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim cell As Range
For Each cell In ActiveWorkbook.ActiveSheet.Rows("3").Cells
If cell.Value = "Hide" Then
cell.EntireColumn.Hidden = True
Else
If cell.Value = "Show" Then
cell.EntireColumn.Hidden = False
End If
End If
Next cell
End Sub
Any help would greatly be appreciated! Thank you
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim cell As Range
For Each cell In ActiveWorkbook.ActiveSheet.Rows("3").Cells
If cell.Value = "Hide" Then
cell.EntireColumn.Hidden = True
Else
If cell.Value = "Show" Then
cell.EntireColumn.Hidden = False
End If
End If
Next cell
End Sub