Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Multiple input variables

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Multiple input variables

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Multiple input variables

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


  #5   Report Post  
Posted to microsoft.public.excel.programming
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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Multiple input variables

I had one more quick question, so if I were to put in the data in an
array format (8x8, 9x9, etc.) is there any way that I would be able to
highlight the cells that correspond to compound 1 (say cells 1-4),
compound 2 (5-8), etc. and have the macro calculate averages based on
this? Sometimes my data will get up to 12x12 and writing a repetitive
if...then statement covering sample numbers ranging from 1-48 would be
really tedious. Not sure if there is a way that the you can denote
cells on a template lets say and have excel use the corresponding cells
for calculations.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array for varying 2 out of many input variables for complicated fx MontyCR Excel Discussion (Misc queries) 0 April 10th 09 07:13 PM
How can I have have one column's input depend on the variables in a second one? willb Excel Worksheet Functions 3 October 18th 06 12:31 PM
Using Ranges to input variables to UDF Peter Bradley Excel Programming 3 October 3rd 04 12:14 PM
Input Command with Mainframe file and multiple variables BSchwerdt[_2_] Excel Programming 4 December 17th 03 11:47 PM
Input variables on Sheet1 being called by a VB program on Sheet 2 RU42 Excel Programming 1 August 23rd 03 09:50 AM


All times are GMT +1. The time now is 04:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"