View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] stephentebaldi@gmail.com is offline
external usenet poster
 
Posts: 13
Default Multiple input variables

Thanks so much for your help, I have been trying to work this out to
make my research easier for a week now. I figured I would be able to
get it all done myself, apparently not though.

Thanks again
Die_Another_Day wrote:
Use an array variable:
Dim Compounds() As String
Dim numCompounds as long
Dim cnt as long
numCompounds = InputBox("Enter the Number of Compounds")
ReDim Compounds(1 to numCompounds)
For cnt = 1 to numCompounds
Compounds(cnt) = InputBox("Please Enter Compound " & cnt)
next

Then Reference like this:
Variable1 = Compounds(1)

Charles

wrote:
So would there be a way to call on these later on? If I was to specify
what compounds were there and then input a range of data is there a way
to enter what cells contain what compounds to make calculations easier?
Most compounds will have multiple cells which will require an average.
Die_Another_Day wrote:
Try something like this:
Dim numCompounds as long
Dim cnt as long
numCompounds = InputBox("Enter the Number of Compounds")
For cnt = 1 to numCompounds
Range("A" & cnt) = InputBox("Please Enter Compound " & cnt)
next

Charles
wrote:
I am trying to make a macro that will allow me to specify the number of
compounds that will be used in an experiment and then display that many
input boxes (or a list box if that will work) for the user to input the
names of the compounds. I am having a hard time figuring out if this
is possible because the loop doesn't seem to want to keep the names of
each compound separate. Any help would be much appreciated.

TIA
Stephen