ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   is it possible to run code written inside a cell (https://www.excelbanter.com/excel-programming/442056-possible-run-code-written-inside-cell.html)

EXCEL_LOVER

is it possible to run code written inside a cell
 
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

Paul Robinson

is it possible to run code written inside a cell
 
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

On Apr 27, 8:27*am, EXCEL_LOVER wrote:
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




All times are GMT +1. The time now is 10:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com