Need help with Procedure to return selected column numbers
One more...
Option Explicit
Sub testme()
Dim myStr As String
Dim myCell As Range
Dim myRng As Range
With ActiveSheet
Set myRng = Intersect(Selection.EntireColumn, .Rows(1))
End With
myStr = ""
For Each myCell In myRng.Cells
myStr = myStr & ", " & myCell.Column
Next myCell
myStr = Mid(myStr, 3)
MsgBox myStr
End Sub
Dan Thompson wrote:
I am having trouble with this macro
Sub ReturnColumnNumbers()
Dim ColNum As Integer
ColNum = Selection.Column
MsgBox ("The Selected Column Numbers are" & Chr(13) & ColNum)
End Sub
The problem is it works when I select just one column but if I select more
than one column it does not return the other column numbers ?
Any thoughts ?
Dan Thompson
--
Dave Peterson
|