Excel VBA: Create new conditions

W

wuming

Hi all,

I have this program with a userform With a click of a command button i
the userform, i want program to prompt user using input box for no. o
criteria tables to create. (eg. in attchment>> LUTS)
After prompting for no. of LUTS to create, program would prompt fo
each LUTS no. of criteria in each LUT.

Eg: command button click:
inputbox: "Enter no. of LUT to create: " Eg. 3 in the attachment
then next:
inputbox: "Enter no. of criteria in LUT no. 1: " Eg. 5 in th
attachment
inputbox: "Enter criteria no. 1: " Eg. Tan
inputbox: "Enter criteria no. 2: " Eg. Joo
.....
.....
inputbox: "Enter criteria no. 5: " Eg. Lee

Then this will continue for the 2nd LUT:
inputbox: "Enter no. of criteria in LUT no. 2: " Eg. 4 in th
attachment
inputbox: "Enter criteria no. 1: " Eg. Alexander
.....
.....
inputbox: "Enter criteria no. 4: " Eg. Hoh

this will continue until all LUT and their criterias are created.
Anyone knows how to do this using vba??
This is really complicated for me for someone of my lvl. :/
pls see attachment for details. Thanks in advanced.

Abyss of the goa

Attachment filename: newsample.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=63522
 
B

Bob Phillips

The basic code is a number of simple loops

numLUTS = inputbox: "Enter no. of LUT to create: "
For i 1 To numLUTS
numCriteria = inputbox: "Enter no. of criteria in LUT no. " & i
For j = 1 to numCriteria
criteria = inputbox: "Enter criteria LUT no. " & i & " no "
& j
Next j
Next i

The tricky part is processing criteria when you have it. What do you
want to do with it?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
T

Tom Ogilvy

Just put additional controls on the userform for the user to enter the
number of LUTS, then you can provide a couple of textboxes for the user to
enter the details. After each set of criteria is entered, you event code
would clear the textboxes and prompt (use a label) for the next LUTS'
criteria.
 
W

wuming

s> The tricky part is processing criteria when you have it. What do yo
want to do with it?

actually, after creating the LUTs, i want program to compare the LUT'
criterias against the data cells and display the count of the no. o
cells that matched. As you can see from the attachment, the result
sheet shows 2 result of count: 1 is the result of count from individua
criteria in the LUT and 1 is the result of the combined LUT's criterias
So does this make sense??
Anyone??
y>
Just put additional controls on the userform for the user to ente
the
number of LUTS, then you can provide a couple of textboxes for th
user to
enter the details. After each set of criteria is entered, you even
code
would clear the textboxes and prompt (use a label) for the nex
LUTS'
criteria.

can u show an example tom?
 

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