![]() |
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. |
All times are GMT +1. The time now is 01:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com