![]() |
Need help with Procedure to return selected column numbers
try this UDF:
Option Explicit Function ColumnCount(target As Range) As String Dim cl As Range Dim text As String For Each cl In target.Columns text = text & "," & cl.Column Next text = Mid(text, 2) ColumnCount = text End Function "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 |
All times are GMT +1. The time now is 10:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com