![]() |
Use variabel as reference
Hi Everyone:
I need some help here. The code below is just a sample of what I'm trying to do. I need to use the value in a variable as the reference for another variable. In the code below I will create "xy2" in "zz" then display "zz". If the code is correct it should display "Congratultaions!!!" the value for "xy2". How can I do that change in reference? Sub xref() xy2 = "Congratulations!!!" yy = 2 zz = "xy" & yy MsgBox zz End Sub Andres Angel |
Use variabel as reference
pass the variable to it sub passme() dim xy2 as string xy2 = "Congratulations!!!" ref xy2 end sub Sub xref(var as string) yy = 2 zz = var & yy MsgBox zz End Sub Sub xref() xy2 = "Congratulations!!!" yy =Sub xref() xy2 = "Congratulations!!!" yy = 2 zz = "xy" & yy MsgBox zz End Sub 2 zz = "xy" & yy MsgBox zz End Sub -----Original Message----- Hi Everyone: I need some help here. The code below is just a sample of what I'm trying to do. I need to use the value in a variable as the reference for another variable. In the code below I will create "xy2" in "zz" then display "zz". If the code is correct it should display "Congratultaions!!!" the value for "xy2". How can I do that change in reference? Sub xref() xy2 = "Congratulations!!!" yy = 2 zz = "xy" & yy MsgBox zz End Sub Andres Angel . |
Use variabel as reference
Sub xref()
Dim xy(1 To 10), yy, zz xy(2) = "Congratulations!!!" yy = 2 MsgBox xy(yy) End Sub -- HTH RP "Andres Angel" wrote in message ... Hi Everyone: I need some help here. The code below is just a sample of what I'm trying to do. I need to use the value in a variable as the reference for another variable. In the code below I will create "xy2" in "zz" then display "zz". If the code is correct it should display "Congratultaions!!!" the value for "xy2". How can I do that change in reference? Sub xref() xy2 = "Congratulations!!!" yy = 2 zz = "xy" & yy MsgBox zz End Sub Andres Angel |
All times are GMT +1. The time now is 10:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com