testing for 21 conditions with VBA

zakynthos

Board Regular
Joined
Mar 28, 2011
Messages
169
What I would like to do is input a number (incrementing by 1) from 1 to 100 in column B via a Userform which has 2 inputs and 1 output:


I have data in an array from a1:v10000
Col A
Integers in blocks of 100, incrementing by one
Rows 1 – 100 are all 1’s
Rows 101-201 are all 2’s etc
Col B
(This is where data is to be input)
Cols C:V (and rows 1:20, 21:40 etc)
Contain a 1-20 respectively, (to denote criteria) so C1 would be criteria 1 and V1 would be criteria 20. C21 would be a 1 as the cycle repeats.

2 Inputs
No. of recipient? (answers will be between 1 and 100)
Criteria no? (answers will be between 1 and 20)
One output
An integer in Column B, incrementing by 1 per row according to the answers to the 2 inputs
(representing the no. of emails to be sent to each recipient)

Example
If input (answer) to inputs was 1, 1, then output would be a 1 in cell B1
If input (answer) to inputs was 1, 2, then output would be a 2 in cell B2
If input (answer) to inputs was 1, 20, then output would be a 20 in cell B20

So the loop would therefore cycle blocks of 20:
If input (answer) to inputs was 1, 1, then output would be a 1 in cell B21
If input (answer) to inputs was 1, 2, then output would be a 2 in cell B22
If input (answer) to inputs was 1, 20, then output would be a 20 in cell B40
This would continue until the end of the first block for recipient no 1 (at row 100)
If input (answer) to inputs was 1, 20, then output would be a 100 in cell B100
The start of the second block of recipients (recipient 2) at row 101:
If input (answer) to inputs was 1, 1, then output would be a 1 in cell B101
The cycle continues until row 10000
If input (answer) to inputs was 1, 20, then output would be a 100 in cell B10000


Many thanks:)
 
Last edited:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top