Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Validation against two criteria
Bascially I have a routine that allows a user to select certain days of the
week using a MultiSelect listbox and a range of time in two inputboxes (BeginDate and EndDate). Based on that criteria, the macro selects random dates from the date range. I need to do two things: 1. Ensure that the random day selected is a day selected by the user in the listbox 2. If the day is valid, I need to ensure that the date has not already been selected If either 1 or 2 are not valid, another random date must be chosen and then tested against 1 and 2 again. I have another project in which random numbers are selected and I call a separate function to check for duplicate values. I tried using that and another function to test for the valid day, but I'm getting lost when a new date is selected and having to test for both criteria again. Any help is appreciated. TIA Mike -- Michael J. Malinsky |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Validation against two criteria - clarification
A little clarification...
As stated in my previous post, I have a function that can check for a duplicate number that I'm trying to use in this project. So what I am currently trying to do is create a second function that will check for a valid day. So my main sub first calls the day validation function then the duplicate number function, passing the appropriate variables. So if I have a bad day, the the function will select another day until a valid one is selected, then if a duplicate date is chosen, another will be selected until a non-duplicate is selected. But then if this non-duplicate is not a valid day, the valid_day function is no run again to catch this problem. I feel that I should somehow capture the selected items from the listbox in an array rather than using an if selected loop to check for the valid day, but I'm not sure if that will solve the problem. I also get the feeling that I could use a while...wend statement in the main sub that checks for a flag value that would be set if both criteria mentioned in my previous post are met. Any suggestions? Again, TIA. Mike -- Michael J. Malinsky "Michael J. Malinsky" wrote in message ... Bascially I have a routine that allows a user to select certain days of the week using a MultiSelect listbox and a range of time in two inputboxes (BeginDate and EndDate). Based on that criteria, the macro selects random dates from the date range. I need to do two things: 1. Ensure that the random day selected is a day selected by the user in the listbox 2. If the day is valid, I need to ensure that the date has not already been selected If either 1 or 2 are not valid, another random date must be chosen and then tested against 1 and 2 again. I have another project in which random numbers are selected and I call a separate function to check for duplicate values. I tried using that and another function to test for the valid day, but I'm getting lost when a new date is selected and having to test for both criteria again. Any help is appreciated. TIA Mike -- Michael J. Malinsky |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Data Validation with 2 criteria | Excel Worksheet Functions | |||
Setting the Validation Criteria on the fly | Excel Discussion (Misc queries) | |||
multiple data validation criteria | Excel Discussion (Misc queries) | |||
Data validation two criteria | Excel Worksheet Functions | |||
Validation - multiple criteria in one cell | Excel Discussion (Misc queries) |