![]() |
Determining number of columns of 2 different ranges
I'm selecting two separate areas of my worksheet using Ctrl-Click(drag);
a1:a4 and c1:c4 I would like to know how to get the column number 1 for colum "A" and 3 for colum "C". pd, I'm not always using the same areas (it could be d1:d56 and g1:g7; and in this case I want 4 and 7 respectivly). TIA |
Determining number of columns of 2 different ranges
Hi
May be this will do: Dim colOne As Integer, colTwo As Integer colOne = Cells(1, Mid(Left(Selection.Address, 2), 2, 1)).Column colTwo = Cells(1, Left(Right(Selection.Address, 3), 1)).Column MsgBox "First column = " & colOne & vbLf _ & "Second column = " & colTwo HTH Cordially Pascal "filo666" a écrit dans le message de news: ... I'm selecting two separate areas of my worksheet using Ctrl-Click(drag); a1:a4 and c1:c4 I would like to know how to get the column number 1 for colum "A" and 3 for colum "C". pd, I'm not always using the same areas (it could be d1:d56 and g1:g7; and in this case I want 4 and 7 respectivly). TIA |
Determining number of columns of 2 different ranges
Dim ra As Range
For Each ra In Selection.Areas Debug.Print ra.Columns(1).Column Next Regards, Peter T "filo666" wrote in message ... I'm selecting two separate areas of my worksheet using Ctrl-Click(drag); a1:a4 and c1:c4 I would like to know how to get the column number 1 for colum "A" and 3 for colum "C". pd, I'm not always using the same areas (it could be d1:d56 and g1:g7; and in this case I want 4 and 7 respectivly). TIA |
All times are GMT +1. The time now is 08:44 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com