Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default mapping columns

Greetings

Is there a way to map column number to alphabet such column 6 equates to "F"
and column equates to AA.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default mapping columns

Not really sure what you want here but perhaps the following will help. The
first 2 return the column number from the alpha id and the second 2 return
the column alpha id from the column number. Returning the Address (alpha id)
the parameters indicate whether to return absolute or relative. ,0 is
relative and 1 (or no parameter) returns absolute.

Sub test()

MsgBox Columns("AA").Column
MsgBox Columns("F").Column

MsgBox Columns(27).Address(, 0) 'Relative
MsgBox Columns(6).Address(, 1) 'Absolute
MsgBox Columns(6).Address() 'Absolute

End Sub

--
Regards,

OssieMac


"Farooq Sheri" wrote:

Greetings

Is there a way to map column number to alphabet such column 6 equates to "F"
and column equates to AA.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default mapping columns

I should perhaps have expanded my answer to show you how to extract just the
alpha column id. I have used a variable for the position of the colon to make
it self explanatory but you could nest the entire forumla in one line of code.

Dim ColonPos As Integer
ColonPos = InStr(1, Columns(27).Address(, 0), ":")

MsgBox Left(Columns(27).Address(, 0), ColonPos - 1)

--
Regards,

OssieMac


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default mapping columns

Another way

Dim lngCol As Long

lngCol = 27
Msgbox Split(cells(1,lngCol).address,"$")(1)

--
Jacob


"Farooq Sheri" wrote:

Greetings

Is there a way to map column number to alphabet such column 6 equates to "F"
and column equates to AA.

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default mapping columns

Does this do what you want...

ColumnNumber = 5
ColumnLetter = Split(Cells(1, ColumnNumber).Address(1, 0), "$")(0)

--
Rick (MVP - Excel)


"Farooq Sheri" wrote in message
...
Greetings

Is there a way to map column number to alphabet such column 6 equates to
"F"
and column equates to AA.

Thanks


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
mapping? columns from one excel workbook to another Jadooi Excel Discussion (Misc queries) 1 December 12th 09 01:08 AM
mapping me Excel Discussion (Misc queries) 1 December 5th 08 10:47 PM
Excel 2003: Mapping rows (x-axis) vs multiple columns (y-axis) Tom Excel Discussion (Misc queries) 1 May 29th 07 01:03 PM
Macro to copy columns from 1st sheet to 2nd according to mapping-p Pawan Excel Programming 2 June 22nd 05 05:53 AM
Using Excel's XML mapping/export with data organized in columns DaveWhatmuff Excel Worksheet Functions 0 June 16th 05 06:53 PM


All times are GMT +1. The time now is 04:30 AM.

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"