Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Column Property, Indirect reference?

I found this snip of code from Tom Ogilvy responding to a question from
OkieViking on how to convert the column# to the column-letter.

i= 27
colLetter = Left(cells(1,i).address(0,0),1-(cells(1,i).Column26))

I am looking for a concise way to do the converse.

i = "AA10"
colnum = ?formula? where the answer is 27
rownum = ?formula? where the answer is 10

I already have written a conversion routine using the ASC() function, some
string functions and loopiing, but I thought there might be a better (faster)
way to accomplish this.

I tried using the .column property, but that used the address of the cell
instead of its value.

in excel i would use =Column(indirect(Z10))
with Z10 containing the value "AA10" this would return 27, perhaps i could
use the external function call in VBA to do this, but I need to use the least
amout of resources to acomplish this task.

--
Regards,
John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Column Property, Indirect reference?


John,

Sub Test()
Dim lngCol As Long
Dim lngRow As Long

lngCol = Range("AA10").Column
lngRow = Range("AA10").Row
MsgBox lngCol & " " & lngRow

End Sub

Regards,
Jim Cone
San Francisco, USA


"John Keith" wrote in message
...
I found this snip of code from Tom Ogilvy responding to a question from
OkieViking on how to convert the column# to the column-letter.

i= 27
colLetter = Left(cells(1,i).address(0,0),1-(cells(1,i).Column26))

I am looking for a concise way to do the converse.

i = "AA10"
colnum = ?formula? where the answer is 27
rownum = ?formula? where the answer is 10

I already have written a conversion routine using the ASC() function, some
string functions and loopiing, but I thought there might be a better (faster)
way to accomplish this.

I tried using the .column property, but that used the address of the cell
instead of its value.

in excel i would use =Column(indirect(Z10))
with Z10 containing the value "AA10" this would return 27, perhaps i could
use the external function call in VBA to do this, but I need to use the least
amout of resources to acomplish this task.

--
Regards,
John

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
object reference does not support this property or method [email protected] Excel Discussion (Misc queries) 2 June 14th 06 07:23 PM
Making column reference in INDIRECT non-static Bob Tarburton Excel Worksheet Functions 4 February 10th 06 07:09 PM
Indirect reference (again?) Hundikoer Excel Worksheet Functions 6 October 25th 05 05:12 PM
Excel should have a absolute reference cell property. Unitrip Excel Discussion (Misc queries) 5 March 27th 05 04:55 PM
Cannot use .IsBroken property of a Reference object - error 48 R Avery Excel Programming 0 December 14th 04 03:53 PM


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