Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2006

Tip: Looking for answers? Try searching our database.

Excel needs function to Convert Rowindex into RowCode (2 -> B)etc

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Markus - 22 May 2006 11:04 GMT
something like:
Function Number2Row(Number As Long) As String
' 1 bis 256
Dim OrgValue As Long
Dim newValue As Long
Dim Rest As Long

OrgValue = Number

If Number <= 0 Then
   result = ""
   GoTo finish
End If

'Rest = Number Mod 26

counter = 0
Do While Number > 26
Number = Number - 26
counter = counter + 1
Loop

'If counter = 0 Then counter = 1

newValue = (OrgValue - (counter * 26))

If counter = 0 Then 'einer
   result = Chr$(Number + 64) & Number2Row(OrgValue - 26)
Else ' ab zweiter Stelle
   result = Chr$(counter + 64) & Number2Row(OrgValue - (counter * 26))
End If

finish:
Number2Row = result
End Function
Tom Ogilvy - 22 May 2006 16:10 GMT
Sounds like you are talking about a column label under A1 style addressing.  
If so, you can just use

? Left(Cells(1,36).Address(0,0),1 - (36>26))
AJ

where 36 could be replaced with a variable that holds the column number.

Signature

Regards,
Tom Ogilvy

> something like:
> Function Number2Row(Number As Long) As String
[quoted text clipped - 40 lines]
>
> http://www.microsoft.com/office/community/en-us/default.mspx?mid=9bac9c6a-da06-4
7b3-8298-ae17b295265f&dg=microsoft.public.excel.programming
Markus - 22 May 2006 16:35 GMT
so that instead of a full function will do it jobs
Thank you!

Left(Cells(1, ActiveCell.Column).Address(0, 0), 1 - (ActiveCell.Column > 26))

> Sounds like you are talking about a column label under A1 style addressing.  
> If so, you can just use
[quoted text clipped - 48 lines]
> >
> > http://www.microsoft.com/office/community/en-us/default.mspx?mid=9bac9c6a-da06-4
7b3-8298-ae17b295265f&dg=microsoft.public.excel.programming
Markus - 22 May 2006 16:46 GMT
would it be possible to add that as an example in the "help"-file for future
versions?

> Sounds like you are talking about a column label under A1 style addressing.  
> If so, you can just use
[quoted text clipped - 48 lines]
> >
> > http://www.microsoft.com/office/community/en-us/default.mspx?mid=9bac9c6a-da06-4
7b3-8298-ae17b295265f&dg=microsoft.public.excel.programming
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.