is it possible to run code written inside a cell

E

EXCEL_LOVER

Is it possible to run code written inside a cell, for example, cell A1
I wrote MsgBox "Hi i am David" When I run the code it has show the
message Hi i am David or else order written in A1 any help appreciated
in advance.
thanks
 
P

Paul Robinson

Hi
Your example does not have any code written inside a cell, so hard to
know what you want. If you want to show the text in A1 in a msgbox you
could use

Function ShowIt(myCell as Range) as Variant
ShowIt = MsgBox(myCell.Value)
End function

and run the sub

Sub RunShowIt()
ShowIt Range("A1")
End Sub

If you really want to run code that is in A1 you will need to run a
sub which starts the code, which begs the question of why not put the
code in A1 into the original sub in the first place?
regards
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top