Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Use CountIf for a literal string | Excel Worksheet Functions | |||
Exctracting Literal Value From A String Variable | Excel Programming | |||
setting a range variable equal to the value of a string variable | Excel Programming | |||
How do I convert an integer variable to a string variable? | Excel Programming | |||
User Defined Type Structure - want it to be variable not numeric literal | Excel Programming |