In the active sheet I have a button that shows a userform vbmodeless which lists, by name, certain columns in the worksheet. The OK button works if the column isn't hidden but if it is I get the error. Why?
Here is my code.
Code:Private Sub cmdOK_Click() Dim rng As Range Dim strColName As String Set rng = Range("1:1").Find(lstLabels.Value, LookIn:=xlFormulas) If Not rng Is Nothing Then rng.EntireColumn.Hidden = True Else strColName = lstLabels.Value Columns(strColName).EntireColumn.Hidden = False End If End Sub




Reply With Quote