LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Example: Generating a Range String from numbers.

This is a coding example of how to make a range string from numbers.

Function RangeString(Row1, Col1, Row2, Col2)
' Return Range String from Arguments.
' No checking for reversed range specs.

RangeString = Nr2Col(Col1) & Row1 & ":" & Nr2Col(Col2) & Row2
End Function

Function Nr2Col(NR)
' Turn NR into Excel Column Designator.
If NR <= 26 Then
Nr2Col = Chr(64 + NR)
Else
Nr1 = Chr(64 + Int(NR / 26))
Nr2 = Chr(65 + NR Mod 26)
Nr2Col = Nr1 & Nr2
End If
End Function

RangeString(1,1,2,5) returns "A1:E2".

Let me know if you find this helpful. Thanks
Mac@ SV-CaliforniaGirl.Com


 
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
RANDBETWEEN generating numbers outside range Penny Black Excel Worksheet Functions 5 May 25th 10 10:14 PM
Generating random numbers tobbey Excel Worksheet Functions 2 January 5th 10 08:05 AM
Generating a random 17-character alphanumeric string Dan Excel Discussion (Misc queries) 7 February 15th 08 05:16 PM
create self-generating numbers with letters and numbers cxlough41 Excel Discussion (Misc queries) 11 January 4th 06 01:16 AM
Convert String of 512 numbers to a range Kevin G[_2_] Excel Programming 10 February 2nd 04 06:02 AM


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