I am trying to use the functions below to hide columns
Function SCPArgsShowOnly() As Boolean
Dim sColsToHide As String
sColsToHide = "E:I,M:N"
hideCols sColsToHide
SCPArgsShowOnly = True
End Function
'======================================================
Sub hideCols(sCols As String)
Dim sTemp() As String, allCols As String
sTemp = Split(sCols, ",")
allCols = "A:N"
With Sheets("Functions")
.Columns(allCols).Hidden = False
For i = LBound(sTemp) To UBound(sTemp)
.Columns(sTemp(i)).Hidden = True
Next
End With
End Sub
It works fine when I run it through the debugger window. But it only returns true when I use it in a cell like this = SCPArgsShowOnly()
What am I missing?