# Excel VBA input box question



## BillDoor (Jul 26, 2006)

I want to be able to run a macro in excel where it brings up a box to start with and I can put in a word and I then want that word to be used for several instances in the macro.

So if I was to type Dave in the I would want to have that word used in several places in my macro, like refering to a sheet with that name in a particular file and then saving a new doc with that name added to the end.

Does that make sense?


----------



## eminent_eddie (May 20, 2008)

Use the InputBox() function. Declare a global variable (outside all sub procedures), e.g.

Public _variable_name_ as String

Then use the inputbox function :

_variable_name_ = inputbox("Enter the word you want to store", "Enter word")

you will then be able to use this variable everywhere in your app.

I hope this helps. I'm new to posting. two years later.


----------

