VBA how to evaluate the value of a variable from a text

  • I have an intermediate / high level knowledge in VBA, making a solution for a friend, I came across a problem that I could not find a solution for, I hope you can help me




    I will summarize it in the simplest way possible




    In cell a1 I have written the word VAR1

  • Welcome to the Forum. Please read the Forum Rules to understand how the Forum works and why I have added Code Tags to your post


    All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.Be sure to use them in future posts.


    How to use code tags


    Just highlight all of the code and press the <> in the post menu above button to add the code tags.


    Thanks.

    • What is this Function, FUNCTION_ WHAT_NECESSARY (range ("a1"). Value)?
    • Why do you need a Function?
    • You don't use Var1 and what point is it?

    You simply need


    Code
    MsgBox Sheets(" sheet name here").Range("A1").Value
  • It is part of a much larger code, I wrote the problem with a simple example.


    I have written a list of variable names, and I need to be able to obtain through code the value they store, through code at runtime.


    I wrote FUNCTION _i NEED, because that routine is the one I need, that from a string, I can obtain the value inside the variable.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!