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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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



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
Determining volume/number. Jim Smith Excel Programming 7 February 20th 06 01:26 PM
need help determining a row number Gary Keramidas Excel Programming 7 November 13th 05 03:54 AM
Determining if two ranges overlap Marky[_2_] Excel Programming 4 February 18th 04 09:54 AM
Determining Row Number Wes Jester Excel Programming 2 August 26th 03 09:20 PM
Determining Active Row Number Don Guillett[_4_] Excel Programming 0 August 20th 03 11:04 PM


All times are GMT +1. The time now is 02:06 AM.

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

About Us

"It's about Microsoft Excel"