Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exctracting Literal Value From A String Variable


For arguments sake, I have a string variable such as,

R1 = \"RANGE(CELLS(ROWPOINTER, COLUMNPOINTER))\"

And, I want to use the literal value of r1 (minus the quotations) in
the Range function

RANGE(R1)

How do I go about accomplishing this task?


--
rocketslinger
------------------------------------------------------------------------
rocketslinger's Profile: http://www.excelforum.com/member.php...fo&userid=4093
View this thread: http://www.excelforum.com/showthread...hreadid=519956

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Exctracting Literal Value From A String Variable

=Cells(rownum, colnum)

HTH
--
AP

"rocketslinger"
a écrit dans le message de
news:rocketslinger.24btmp_1141780205.9646@excelfor um-nospam.com...

For arguments sake, I have a string variable such as,

R1 = \"RANGE(CELLS(ROWPOINTER, COLUMNPOINTER))\"

And, I want to use the literal value of r1 (minus the quotations) in
the Range function

RANGE(R1)

How do I go about accomplishing this task?


--
rocketslinger
------------------------------------------------------------------------
rocketslinger's Profile:

http://www.excelforum.com/member.php...fo&userid=4093
View this thread: http://www.excelforum.com/showthread...hreadid=519956



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exctracting Literal Value From A String Variable


Thank you for the response, but I thought I could get my answer by
keeping it simple.

What I am trying to do is dynamically create my Range argument as my
sheet changes and the only way that I know how to do that is through
the use of strings. For example if I programmmatically create the
following variables and fill them with the associated strings (which
could be longer):

Dim r1, r2, r3, r4 As String

r1 = "Range(Cells(RowPointer0, ColumnPointer1), Cells(RowPointer1,
ColumnPointer1))"
r2 = "Range(Cells(RowPointer0, ColumnPointer2), Cells(RowPointer1,
ColumnPointer2))"
r3 = "Range(Cells(RowPointer0, ColumnPointer3), Cells(RowPointer1,
ColumnPointer3))"
r4 = "Range(Cells(RowPointer0, ColumnPointer4), Cells(RowPointer1,
ColumnPointer4))"

How can I pass the literal value of these strings for use in lets say,

Dim rng As Range
Set rng = Union(r1, r2, r3, r4)
rng.Select

Maybe this is a little clearer. Thanks.


--
rocketslinger
------------------------------------------------------------------------
rocketslinger's Profile: http://www.excelforum.com/member.php...fo&userid=4093
View this thread: http://www.excelforum.com/showthread...hreadid=519956

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Exctracting Literal Value From A String Variable

Try this:

--
AP

'----------------------------------------------
Sub testUnion()
SelectUnion 2, 4, "B", "D", "G", "I"
End Sub

Sub SelectUnion( _
RowPointer0 As Long, _
RowPointer1 As Long, _
ColumnPointer1 As String, _
ColumnPointer2 As String, _
ColumnPointer3 As String, _
ColumnPointer4 As String _
)
Dim r1 As Range
Dim r2 As Range
Dim r3 As Range
Dim r4 As Range

Set r1 = Range( _
Cells(RowPointer0, ColumnPointer1), _
Cells(RowPointer1, ColumnPointer1))
Set r2 = Range( _
Cells(RowPointer0, ColumnPointer2), _
Cells(RowPointer1, ColumnPointer2))
Set r3 = Range( _
Cells(RowPointer0, ColumnPointer3), _
Cells(RowPointer1, ColumnPointer3))
Set r4 = Range( _
Cells(RowPointer0, ColumnPointer4), _
Cells(RowPointer1, ColumnPointer4))
Union(r1, r2, r3, r4).Select
End Sub
'-------------------------------------------


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
Use CountIf for a literal string chadkwelch Excel Worksheet Functions 3 March 21st 10 03:45 AM
Exctracting Literal Value From A String Variable rocketslinger[_5_] Excel Programming 0 March 8th 06 12:59 AM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
How do I convert an integer variable to a string variable? dumbass Excel Programming 2 May 21st 04 07:34 PM
User Defined Type Structure - want it to be variable not numeric literal WyoCracker Excel Programming 1 July 21st 03 09:28 PM


All times are GMT +1. The time now is 05:53 PM.

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"