ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Columns (https://www.excelbanter.com/excel-programming/274356-columns.html)

Clark B

Columns
 
Hi!

I am interested in getting the column of a cell.
If cell D1 is selected and I use this code...

Msgbox Activecell.Column

....then I get 4 inth msgbox. How can I get 'D'?

Regards

Clarkie



steve

Columns
 
Clark,

from Chip Pearson (found with Google Search)

ColLetter = Left(Cells(1, ColNumber).Address(True, False), _
1 - (ColNumber 26))

steve

"Clark B" wrote in message
...
Hi!

I am interested in getting the column of a cell.
If cell D1 is selected and I use this code...

Msgbox Activecell.Column

...then I get 4 inth msgbox. How can I get 'D'?

Regards

Clarkie





Bob Phillips[_5_]

Columns
 
Clark,

Use

MsgBox Chr(ActiveCell.Column + 64)

--

HTH

Bob Phillips

"Clark B" wrote in message
...
Hi!

I am interested in getting the column of a cell.
If cell D1 is selected and I use this code...

Msgbox Activecell.Column

...then I get 4 inth msgbox. How can I get 'D'?

Regards

Clarkie





Clark B

Columns
 
Thanks, works like a charm

Clarkie

"steve" wrote in message
...
Clark,

from Chip Pearson (found with Google Search)

ColLetter = Left(Cells(1, ColNumber).Address(True, False), _
1 - (ColNumber 26))

steve

"Clark B" wrote in message
...
Hi!

I am interested in getting the column of a cell.
If cell D1 is selected and I use this code...

Msgbox Activecell.Column

...then I get 4 inth msgbox. How can I get 'D'?

Regards

Clarkie








steve

Columns
 
Clark,

You're welcome!

And did you see Bob's reply
MsgBox Chr(ActiveCell.Column + 64)

Many ways to get there from here...

Highly recommend going to
www.rondebruin.nl/Google.htm
and downloading his Google Search Add-in.
It's a great way to find past responses to questions and problems.

steve

"Clark B" wrote in message
...
Thanks, works like a charm

Clarkie

"steve" wrote in message
...
Clark,

from Chip Pearson (found with Google Search)

ColLetter = Left(Cells(1, ColNumber).Address(True, False), _
1 - (ColNumber 26))

steve

"Clark B" wrote in message
...
Hi!

I am interested in getting the column of a cell.
If cell D1 is selected and I use this code...

Msgbox Activecell.Column

...then I get 4 inth msgbox. How can I get 'D'?

Regards

Clarkie










Chip Pearson

Columns
 
Bob,

This will work only with columns A-Z. It doesn't work for columns
past Z.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Bob Phillips" wrote in message
...
Clark,

Use

MsgBox Chr(ActiveCell.Column + 64)

--

HTH

Bob Phillips

"Clark B" wrote in message
...
Hi!

I am interested in getting the column of a cell.
If cell D1 is selected and I use this code...

Msgbox Activecell.Column

...then I get 4 inth msgbox. How can I get 'D'?

Regards

Clarkie








All times are GMT +1. The time now is 01:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com