Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Excel needs function to Convert Rowindex into RowCode (2 - B)etc

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


----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...el.programming
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Excel needs function to Convert Rowindex into RowCode (2 - B)etc

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 - (3626))
AJ

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

--
Regards,
Tom Ogilvy


"Markus" wrote:

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


----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...el.programming

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Excel needs function to Convert Rowindex into RowCode (2 - B)

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))


"Tom Ogilvy" wrote:

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 - (3626))
AJ

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

--
Regards,
Tom Ogilvy


"Markus" wrote:

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


----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...el.programming

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Excel needs function to Convert Rowindex into RowCode (2 - B)

would it be possible to add that as an example in the "help"-file for future
versions?


"Tom Ogilvy" wrote:

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 - (3626))
AJ

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

--
Regards,
Tom Ogilvy


"Markus" wrote:

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


----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...el.programming

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
visible rowindex Chris Excel Worksheet Functions 3 September 2nd 08 02:40 PM
can the "convert" function in excel convert to UK gallons? JR Excel Discussion (Misc queries) 2 April 24th 08 04:55 PM
Know rowindex after filtering Maileen[_5_] Excel Programming 2 March 25th 06 07:50 PM
I want to convert 10,000 to "Ten Thousand" using Excel Function Atro Excel Worksheet Functions 1 August 24th 05 12:31 PM
Improve Convert function in Excel Mike VV Excel Worksheet Functions 0 February 3rd 05 04:45 AM


All times are GMT +1. The time now is 04:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"