Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Efficiently transform variables into range address

Just creating the address string is probably the most efficient way (no
object references):

strRangeAddress="A1:" & strcolid(lngCols) & cstr(lngRows)

Function strColid(jColNo As Long) As Variant
If jColNo 0 And jColNo <= 256 Then
If jColNo < 27 Then
strColid = Chr$(((jColNo - 1) Mod 26) + 65)
Else
strColid = Chr$(64 + Int((jColNo - 1) / 26)) & Chr$(((jColNo -
1) Mod 26) + 65)
End If
Else
strColid = CVErr(xlErrNA)
End If
End Function


regards
Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com/FxlV2WhatsNew.htm

"rotor" wrote in message
...
Hello: VBA in Excel XP with Win 2000.

I have two variables that are both long data types. I need to somehow

convert these into an equivalent range address that they would consume if
starting at cell "A1".

For example suppose:

lngCols = 4
lngRows = 3

Range address would be: A1:D3

How in the world can I do this efficiently? Thanks in advance for your

example function.


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
How to create a range address with ADDRESS function? Steve McLeod Excel Worksheet Functions 1 December 18th 08 02:02 PM
How do I transform numbers (different ranges) to text (diff. range Ty Eaton Excel Worksheet Functions 1 December 13th 06 12:57 AM
How to efficiently declare variables Jeff Excel Discussion (Misc queries) 2 June 29th 06 01:56 PM
How to get 500 hyperlink address efficiently? liru Excel Discussion (Misc queries) 4 May 16th 06 03:56 AM
Efficiently transform variables into range address Frank Kabel Excel Programming 0 May 3rd 04 04:10 PM


All times are GMT +1. The time now is 10:35 AM.

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"