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

bacter582

New Member
Joined
Dec 17, 2021
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
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

sub test ()

dim VAR1 as String

dim VAR2 as string

VAR1 = "Hello World"

VAR2 = FUNCTION_ WHAT_NECESSARY (range ("a1"). Value)

msgbox VAR2

'I need the result of VAR2 to be Hello World, that is, to look for the value that is stored' in the variable whose name is written in cell a1.


' when you run the macro it should have a result like the one in the image

end sub
 

Attachments

  • Sin título.png
    Sin título.png
    8.6 KB · Views: 18

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi & welcome to MrExcel.
To the best of my knowledge there is no way to do that.
 
Upvote 0
Glad to help, just a shame it wasn't better news.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top