I can't find my error. I've tried Adding "Set" in front of "colcnt = rng.Columns.Count", where the error is highlighted. I tried several other changes, but no luck. I'm using Excel 2011 on a Mac.
Please help!
Please help!
Code:
Sub FindSales()
Dim rng As Range
Dim colcnt As Long
Dim sortv As String
Dim x As Long
Set rng = Range("VecC1")
sortv = "Sales"
colcnt = rng.Columns.Count
For x = 1 To colcnt
If rng.Cells(1, x).Value = sortv Then
rng.Cells(1, x).EntireColumn.Hidden = False
Else
rng.Cells(1, x).EntireColumn.Hidden = True
End If
Next x
Range("A1").Select
End Sub
Last edited by a moderator: