Posts by AKAUFMAN1

    Hello! My objective with this project was originally to create a program that generates recurring due dates for physical exams.
    When a client is entered into the system for the first time the code looks at their admission date and generates a list of dates that the person will be due for a physical.
    Originally the frequency for physical exams was 30 days from the date of admission and every 180 days until their discharge date or until todays date.
    Every time the user selects a patient on the user form, the code runs and will add any new dates to the schedule that are required based on the 180 day frequency and todays date. This code worked fine.

    Now, I have been told that the frequency for appointments is no longer every 180 days for all children, now it is based on the child’s age at admission.
    The children now need to have a physical exam at the following ages:
    5 days old
    Every month from age 1 month old to age 6 months old
    Every 3 months from age 6 months old to age 18 months old
    Every 6 months from age 18 months old to age 84 months old (7 years old)
    Every 12 months from age 7 to 21
    Below , I have shared my original code that worked fine with the initial 30 day frequency and then 180 day frequency following the initial.
    I am also sharing a new function I wrote that will get the First Due Date based on the Childs age at Admission but this is where I am having trouble:

    [SIZE=20px]How and where can I insert this function (or an adapted version of the function) into the original code to account for the child's age and the correct frequency each time the loop occurs to add the right due date to the schedule?[/SIZE]

    [SIZE=14px]This is my Original Code that does the job of the original objective[/SIZE][SIZE=14px][/SIZE]

    [SIZE=14px]This is the function I wrote [/SIZE][SIZE=14px]to figure out what the first due date should be for the schedule based on the age of the child in months or days[/SIZE]

    Function FirstDueDate() As Date[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]Dim AdmissionDate As Date, DOB As Date, FirstDateAfterAdmission As Date, FirstDue As Date[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]Dim DaysOld As Boolean[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]DaysOld = False[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]    With PHYSICAL1[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]        ACrow = ActiveCell.Row[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]        AdmissionDate = CDate(.Cells(ACrow, 3).Value)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]        DOB = CDate(.Cells(ACrow, 11).Value)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]        AdmissionAge = date_diff_to_months(DOB, AdmissionDate)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]        FirstDateAfterAdmission = DateAdd("d", 30, AdmissionDate) 'initial physical needs to occur within 30days of Admission[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]        'FIGURE OUT WHAT FIRST DUE DATE SHOULD BE BASED ON AGE[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                Select Case AdmissionAge[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is < 1 'IF CHILD IS LESS THAN A MONTH OLD AT ADMISSION[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        DaysOld = True[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        AdmissionAge = DateDiff("d", DOB, AdmissionDate)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                            If AdmissionAge <= 5 Then 'CHILD IS 5 DAYS OLD OR YOUNGER[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                Debug.Print "Schedule starts at 5 days Old"[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                Select Case AdmissionAge[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                    Case 1[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                        FirstDue = DateAdd("d", 4, DOB)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                    Case 2[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                        FirstDue = DateAdd("d", 3, DOB)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                    Case 3[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                        FirstDue = DateAdd("d", 2, DOB)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                    Case 4[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                        FirstDue = DateAdd("d", 1, DOB)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                    Case 5[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                       FirstDue = DOB[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                End Select[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                            Else 'CHILD IS BETWEEN 6 DAYS OLD AND 30 DAYS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                Debug.Print "Schedule starts at 1 Month old"[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                                FirstDue = WorksheetFunction.EDate(DOB, 1)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                            End If[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case 1 To 6  'CHILD IS BETWEEN 1 AND 6 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, AdmissionAge)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 9 'CHILD IS BETWEEN 6 AND 9 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 9)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 12 'CHILD IS BETWEEN 9 AND 12 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 12)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 15 'CHILD IS BETWEEN 12 AND 15 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 15)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 18 'CHILD IS BETWEEN 15 AND 18 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 18)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 24 'CHILD IS BETWEEN 18 AND 24 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 24)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 30 'CHILD IS BETWEEN 24 AND 30 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 30)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 36 'CHILD IS BETWEEN 30 AND 36 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 36)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 42 'CHILD IS BETWEEN 36 AND 42 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 42)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 48 'CHILD IS BETWEEN 42 AND 48 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 48)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 54 'CHILD IS BETWEEN 48 AND 54 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 54)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 60 'CHILD IS BETWEEN 54 AND 60 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 60)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 66 'CHILD IS BETWEEN 60 AND 66 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 66)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 72 'CHILD IS BETWEEN 66 AND 72 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 72)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 78 'CHILD IS BETWEEN 72 AND 78 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 78)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is <= 84 'CHILD IS BETWEEN 78 AND 84 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = WorksheetFunction.EDate(DOB, 84)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                    Case Is > 84 'CHILD IS MORE THAN 84 MONTHS OLD[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                        FirstDue = DateAdd("d", 30, AdmissionDate)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]                End Select[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]           [/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]    End With[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]    If DaysOld = True Then Debug.Print AdmissionAge & " Days Old at Admission" Else: Debug.Print AdmissionAge & " Months Old at Admission"[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]        Debug.Print FirstDue & " FirstDue"[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]        Debug.Print FirstDateAfterAdmission & " FirstDateAfterAdmission"[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]    If FirstDateAfterAdmission < FirstDue Then FirstDueDate = FirstDateAfterAdmission Else: FirstDueDate = FirstDue[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]        Debug.Print FirstDueDate & " FirstDueDate"[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]    currentAge = date_diff_to_months(DOB, FirstDueDate)[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]    Debug.Print currentAge & " Months Old at time of Due Date"[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000]End Function[/COLOR][/SIZE][/FONT][FONT=Calibri][size=12][COLOR=#000000][B]


    This is an example of a piece of my userform code that is used many many times in the application referencing different listboxes, list columns, and sheet ranges each time. I have been trying to create a sub procedure with parameteres to use instead , but i keep getting stuck when trying to reference the sheet range.

    This is the sub i tried to create:

    Public Sub PassARange(lbName As MSForms.ListBox, lbListCol As Integer, filteredRng As Range)
    r = lbName.ListIndex
    RecordNumber = lbName.List(r, lbListCol)
        With APPOINTMENTS1
            Set filteredRng = filteredRng.Find(What:=RecordNumber, LookAt:=xlWhole)
                If Not filteredRng Is Nothing Then Application.Goto filteredRng
        End With
    End Sub

    And this is how i tried to call it....

    Call PassARange(UserForm2.ListBoxAppointments, 20, .Range("U2:U" & .Cells(Rows.Count, "A").End(xlUp).row). _

    Can someone please help me figure out how i am supposed to reference the range? Each time i use this piece of code i need to reference an entire column of only visible cells, as this usually comes after code to filter the sheet. The columns also need to always reference the last row, as data is continuously added.

    Thank you !

    Hello! When a user selects an item from the multicolumn Listbox ( ListBoxNonRoutine) in UserForm2 and then clicks the UpdateButton, UserFormNonRoutine is opened. Then the user can update the control values in UserFormNonRoutine and clicks Save to update the control values on UserFormNonRoutine and update the worksheet cell values. After the cells are updated, ListBoxNonRoutine from the original UserForm2 multicolumn Listbox is refreshed to reflect the changes as well. This all works....but what i am having trouble doing is having the code automatically select the original item that was selected and updated in ListBoxNonRoutine. The only way i have been able to refresh the listbox is by clearing it first but when i clear it, it deselects the item. Here is the code:

    I have a worksheet selection change event that sets the values in column A as such:

    Sheets("Investigation Grid").Range("A2").Value = 1
    LastRow2 = Range("B" & Rows.Count).End(xlUp).Row
    Sheets("Investigation Grid").Range("A3:A" & LastRow2).FormulaR1C1 = "=IF(RC[7]=R[-1]C[7],R[-1]C,R[-1]C+1)"

    So if the value in column H matches the value in column H for the row above it, then the index number in column A is the same as the index number in column A in the row above, if the value in column H does not match the value in column H in the row above, then the index number in column A is +1 of the index number in row above it.
    This is a way for me to group rows that belong to the same case number found in column H.

    I am trying to add to my worksheet selection change event to look at each index number as its own range… then look at the values in column 22 of that index number range.
    For instance, there are 4 rows that have index number 78.
    Within those 4 rows, I want to look at column 22 and if any of the values in the 4 rows in column 22 say “Substantiated” or “Indicated” then all 4 rows in column 41 should return “Substantiated” or “Indicated” based on whichever value is found in column 22. If none of the column 22 values are “Substantiated” or “Indicated” then the values in Column 41 should be the same as the values in column 22.

    I have updated this to include code i started working on. The ElseIf section is where i need assistance! Thank you !

    It is not possible to change a control's Name or Tag at run time.

    I will have time over the weekend to look into using the variable column number method further, and get the ListBox1_Click procedure working.

    Thank you KjBox! I'm sorry I am just seeing your response. I have been on vacation the past week! If you are able to find a solution, please let me know! It would be incredibly helpful!!

    I cant figure out a way to actually loop through the controls and add or update the tag property at run time either.

    Thank you both for the responses.
    KjBox : I hear what you are saying, so if i used that logic of re-naming the controls ( or even putting the column header name in the tag property of each control ) i'm not sure how i would then modify my code that uses the other naming convention i was using by putting column number in the name. For example: part of my listbox click code,

    So i am having trouble figuring out how i would modify code like this to use the new naming convention?

    In regards to your question about the text boxes and combo boxes being disabled. The boxes are enabled until the user clicks the listbox or clicks search. They are then disabled until the user clicks update record button.

    If you reference column numbers in the tag property and then later on you need to insert a new column right in the middle of the spreadsheet (let’s say column 15) ..., all of the current tags from 15 on will need to increase by 1 ... is there a way to loop through all the tags and update them without having to manually adjust all of the tags in the property window ?

    I know...neither can i ! So there is basically no way to modify control names at all unless you manually do it? I wouldn't mind if it was just adjusting the code by increasing the numbers manually but it also requires going into the properties of each control and changing those as well...and as you can see there are about 50 of them on page 1 of the multipage alone.

    Yes, but not just the label#..any of the control name #'s to always reflect the column#... This is more straight forward example using the first part of my ListBox1_click event which references just the combobox and textbox controls being filled when the list box is selected:

    ListBox1 is populated using :

    LastRow = Tracking.Cells(Rows.Count, "A").End(xlUp).Row   
        Set myTable = Tracking.Range("A6:AU" & LastRow) 
        ListBox1.List = myTable.Value

    So the code is filling the boxes based on the ListBox Column Numbers which are associated with the columns on my Tracking.sheet ...therefore if i were to insert a new column anywhere in Tracking sheet other than at the very end, it would throw off all of the control name references.

    The weird thing is, there were under 10 rows... so i have no idea why it was taking so long.
    What i decided to do instead was replace the part of the code for filtering the table by comboboxx2.value with a subroutine i created for copying the applicable values into a temp sheet like this....

    Then proceeding with the loop for referencing the labels.
    That seemed to speed it up CONSIDERABLY!

    I have attached the workbook. AllTracking1 is the sheet for which the UserForm2 controls reference the column numbers. . . So ComboBoxx2 represents Column 2 of AllTracking1.
    On Page 1 of UserForm2. MultiPage Form their are many more controls which reference the columns such as... Labelx21 , TextBoxx21, CheckBoxx21, CheckBox21, ComboBox21, ComboBoxNo21 all reference column 21 of AllTracking1 sheet. I am just trying to find a fast way to update all of these control names so if i need to add a column after the column which is currently 20 (or T) , i can update all of the controls that originally had 21 in their name to now have 22 in their name.

    Hello! I have a lot of controls on a UserForm that are named in association with the column number they represent. For instance: TextBox1, TextBox2, TextBox3, etc. up to the 50's. Their are not only TextBoxes but also Labels and CheckBoxes that follow the same naming convention. All of my code relies on this naming convention when referencing the controls.
    The other day i had a request for a new column A to be added to the sheet, resulting in me having to manually change the name property of every single control to be + 1 of what it currently was set at. My question is, if a column needs to be added anywhere on the sheet in-between current columns, how can i change all of the control names without manually going in and updating the properties (which takes a VERY long time). I tried creating a loop like this, but it doesn't work. The debug error i get is Run-time error 382: Could not set the name property. Can no set property at runtime.

    Thank you for your response Ger! I greatly appreciate it!
    1. I updated the code to reflect your suggestion with removing the Activate and Select statements and replaced with the reference to the range. That was exactly what i was looking for.
    2. I took out the Application.EnableEvents... I did not know that it was not applicable to userform controls so thank you!
    3. Instead of having a ton of change event codes for each checkbox and combobox involved in this event (there will end up being about 40 of each control), is it possible for me to create a Class Module with a change event to include the whole group of controls involved based on when ComboBoxx2 changes to a new name? I have a few Class Modules already in action but i'm just not sure how i would include the current code in a class module to satisfy the objective.
    4. My listbox is not linked via .rowsource. It is set up like this:

    Set mySheet = ThisWorkbook.Sheets("All.Tracking1") 
    LastRow = mySheet.Cells(Rows.Count, "A").End(xlUp).Row
    Set myTable = mySheet.Range("A6:AS" & LastRow)
    ListBox1.List = myTable.value

    After updating my code to reflect the changes you suggested in Number 1 , the code is still running VERY slow... I think i narrowed it down to the reason being this part of the code...

    DEsheet.ListObjects("Table6").Range.AutoFilter Field:=1, Criteria1:=UserForm2.ComboBoxx2.value

    So instead of filtering the table to find ComboBoxx2.value and then search for the Labelx values within the filtered range... I tried to use a Find/Find Next method.
    I created a separate module outside of the userform and testing it by just finding a name and looping through to provide the column 4 value of each instance of the name found.
    This was successful.

    However, when i added it to the userform module and added in the For Each and For loops in between Do and Loop, along with all the UserForm references, i got Run-time Error 91: Object Variable or With Block Variable Not Set.

    This is the new full code that i cant get to work, i extracted it from ListBox1_Click Event and made it its own button for testing:

    When Debugging this is the highlighted line

    Loop While Not FoundName Is Nothing And FirstNameAddr <> FoundName.Address

    The error seems to be with FoundName.Address , as that is the variable showing "object variable or with block variable not set"
    Additionally, when i hoover over A, it is showing A = 45.... but it should be 44 and hoovering over the Label variable shows "CRAFFT Screening" which is accurate for Labelx44.Caption.

    Hello, the following part of my ListBox1.Click Event REALLY slows down the entire sub. I know there must be a more efficient way to loop through the controls without slowing down the code. Please Help! I am leaving out a lot of the beginning of the event to focus in on what i really need help with. It is also important to note that all of my control names have a number in them that is associated with the column in which the data lives on "Tracking" sheet. When the listbox is selected, i am trying to achieve the following: Based on the value entered in ComboBoxx2 "persons name" , the code will locate the ComboBoxx2 value in DEsheet table6 col 1 , and then if their name is in the table, it will loop through table column 3 checking for the label captions in the ConsentsFrame2. controls. If it finds the label captions in column 3 then it makes the checkbox associated with that label true and takes the value in table column 4 and puts that number in the combobox associated with that label caption. If it does not find the label caption in column 3 then the No checkbox associated with that label caption is marked as true. After all that, it searches for the youths name (ComboBoxx2).value on another sheet in another table MDsheet.ListObjects("Table68"). Loops through table column 2 to find the label captions again and if found, the "MD Signed" checkbox associated with that label caption is marked as true.

    Hello! This is my first post here! I have been using this site for about a year now and it has been a tremendous resource.
    I am usually able to figure out my questions on my own but after several days of googling my current problem, i am still very stuck.
    My UserForm (UserForm1) is almost fully functional with the exception of one problem:
    My objective: When clicking the Search button, the listbox will display results for only "Active" records and the other search criteria identified. The user searches for a record, by making their selections in both Combo Boxes (Combobox1 and ComboBox15), then they can click the checkbox (CheckBox2) to filter column F by "Active".

    Problem: I am able to get the code to filter the sheet "Assessment.Tracking" to reflect the value of selection made in ComboBox.15 according to the column associated with ComboBox1.value and to reflect the CheckBox2 value of True ("Active") in column F, but for some reason the ListBox(ListBox1) is not reflecting the correct List.Count or the correct rows in the ListBox.List. It is not accounting for a few of the rows that do in fact meet the criteria of both the ComboBox15.value and the CheckBox2.Value.

    I have tried this with and without the checkbox2 change event and it seems to be yielding the same results.
    I have also attached the workbook.
    Thank you in advance for any help offered!