Excel VBA Newbies - Is there a better syntax to code the if
Hi:
I am new to VBA, I have the following code, in the If statement, how
can I code it better instead of using lots of "OR". Is there a better
way or string comparison.
================================================== ====================
Dim lcCol As String
lnColCount = ActiveSheet.UsedRange.Columns.Count 'Column Count
For j = 1 To lnColCount
lcCol = GetExcelColumn(j)
If lcCol = "G" Or lcCol = "H" Or lcCol = "AB" Or lcCol =
"AF" Then
Columns(lcCol + ":" + lcCol).Select
Selection.EntireColumn.Hidden = True
End If
Next j
================================================== ====================
Thank you
Peter
|