PC Review


Reply
Thread Tools Rate Thread

column adjustments

 
 
dstiefe
Guest
Posts: n/a
 
      5th Dec 2008
I am writing the VBA code that is telling me what column a certain piece of
data is in...but instead of giving me the number of the column...is there
someway through VBA that it i can get the letter reference.
 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      5th Dec 2008
The code you would use depends on what you are doing to locate the column.
For example, if you have the column number, you could do this...

ColNum = 4
ColLetter = Split(Columns(ColNum).Address(0,0),":")(0)

If you have a cell reference that is in that column, then you could do
this...

ColLetter = Split(CellReference.Address(1, 0), "$")(0)

There are lots of possibilities depending on what you are doing... can you
show us the code you have so we can give you a specific answer.

--
Rick (MVP - Excel)


"dstiefe" <(E-Mail Removed)> wrote in message
news:BD11E212-5297-4B0D-9C4B-(E-Mail Removed)...
>I am writing the VBA code that is telling me what column a certain piece of
> data is in...but instead of giving me the number of the column...is there
> someway through VBA that it i can get the letter reference.


 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      5th Dec 2008
Here is a Function, courtesy Chip Pearson.

Function ColumnLetter(ColNumber) As String
ColumnLetter = Left(Cells(1, ColNumber).Address(True, False), _
1 - (ColNumber > 26))
End Function


To use the function in code, assume you have set a column number to variable
myCol then:

myColLtr = ColumnLetter(myCol)

myColLtr will now equal an alpha column designation.

"dstiefe" wrote:

> I am writing the VBA code that is telling me what column a certain piece of
> data is in...but instead of giving me the number of the column...is there
> someway through VBA that it i can get the letter reference.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adjustments Andy Microsoft Excel New Users 4 21st Jan 2005 02:55 PM
Prevent Column adjustments? CLR Microsoft Excel Programming 2 11th Dec 2004 03:05 PM
Security adjustments Chakra Microsoft Dot NET Framework Forms 1 24th Nov 2004 11:54 AM
Help! need some adjustments! Simon Lloyd Microsoft Excel Programming 2 27th Apr 2004 10:03 PM
adjustments to ppt xp patschiw Microsoft Powerpoint 0 21st Jul 2003 10:02 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:37 AM.