ker_01 - The following function is simpler and more easily adapted to
any version of Excel
Public Function ColNumToAlpha(iCol As Integer)
'Test to see if iCol is greater than the number of columns your
version of Excel supports
If iCol 256 Then
MsgBox "Number entered is greater than max number of columns in
this version of Excel"
ColNumToAlpha = "Bad iCol Value"
Exit Function
End If
ColNumToAlpha = Columns(iCol).Address
ColNumToAlpha = Mid$(ColNumToAlpha, 2, Len(ColNumToAlpha) -
InStr(ColNumToAlpha, ":") - 1)
End Function
Brian B -
Using the above and bits of Rick's code gets us to:
Public Sub test()
Dim iColNum As Integer
On Error Resume Next
iColNum = Application.InputBox(prompt:="Including Col C, hide this
many columns:", Type:=1)
Columns("C:" & ColNumToAlpha(iColNum)).Hidden = True
End Sub
--
jamescox
------------------------------------------------------------------------
jamescox's Profile:
http://www.thecodecage.com/forumz/member.php?userid=449
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=116866