Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Columns letter of selection

Hi all,

if I select cells B2 to D2, and I run this VBA code :
MsgBox Selection.Address(False, False)
it gives me B2:D2.

I'd like to get the columns only, like B:D
So I tried :
MsgBox Columns(Selection.Column).Address(False, False)
but it gives me B:B

Is there an easy way to solve this without playing with left, right, mid or
instr ?

Thanks for any insight,
Nicomus
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Columns letter of selection

Hi Nicodemus,

Try:

Selection.EntireColumn.Address(0, 0)


---
Regards,
Norman



"Nicodemus" wrote in message
...
Hi all,

if I select cells B2 to D2, and I run this VBA code :
MsgBox Selection.Address(False, False)
it gives me B2:D2.

I'd like to get the columns only, like B:D
So I tried :
MsgBox Columns(Selection.Column).Address(False, False)
but it gives me B:B

Is there an easy way to solve this without playing with left, right, mid
or
instr ?

Thanks for any insight,
Nicomus



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Columns letter of selection

Hi Norman,

great ! It works perfectly the way I wanted it !!

Thank you for your (very) fast and efficient answer.
Nicodemus

"Norman Jones" wrote:

Hi Nicodemus,

Try:

Selection.EntireColumn.Address(0, 0)


---
Regards,
Norman



"Nicodemus" wrote in message
...
Hi all,

if I select cells B2 to D2, and I run this VBA code :
MsgBox Selection.Address(False, False)
it gives me B2:D2.

I'd like to get the columns only, like B:D
So I tried :
MsgBox Columns(Selection.Column).Address(False, False)
but it gives me B:B

Is there an easy way to solve this without playing with left, right, mid
or
instr ?

Thanks for any insight,
Nicomus




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
separate columns (three letter code) mariekek5 Excel Discussion (Misc queries) 7 March 16th 10 01:21 PM
ADD 2 COLUMNS USING 1 LETTER AND 1 NUMBER lorik Excel Worksheet Functions 3 July 6th 09 04:04 AM
How to count letter B based on data in other columns Mero Excel Worksheet Functions 6 May 22nd 09 02:24 PM
CHAR funtcion with double letter columns ellebelle Excel Worksheet Functions 7 July 16th 07 03:05 PM
How do I get the columns in Excel to go back to letter sequence Lostinexcel Excel Discussion (Misc queries) 0 April 27th 05 11:41 PM


All times are GMT +1. The time now is 01:07 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"