Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to return a set of numbers in column A Welby Excel Worksheet Functions 0 August 17th 07 01:55 AM
how to sort a column of Randomly selected numbers? Khoshravan Excel Worksheet Functions 8 July 14th 07 08:16 PM
Function to return # of column with min value in selected rows mr_espresso Excel Worksheet Functions 9 June 24th 06 08:54 PM
Increment numbers in column A by 1 when selected mikeburg[_83_] Excel Programming 4 June 14th 06 10:18 PM
Add selected numbers in a column that are a different color Sam Excel Discussion (Misc queries) 6 March 4th 05 11:46 PM


All times are GMT +1. The time now is 03:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"