I've been working on this issue for almost 4 hours this morning to no avail. Essentially, I have about 30 text boxes that I need to populate from 2 different worksheets based on data entered in a UserForm. I was able to get data to populate the UserForm as I wanted, until I introduced a filter for date range. I've been to multiple sites looking for a solution, but I haven't found one that solves for the entire equation. Here is a snippet of code where I tried to merge multiple solutions into 1, but it doesn't work. Suggestions?
VBA Code:
Private Sub cmd_test_Click()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim m As Workbook
Dim mP As Worksheet
Dim mPFR As Range
Dim mPFRLR As Long
Set m = ThisWorkbook
Set mP = m.Sheets("PRF")
mP.Activate
'Sorts sheet by Mgr, Assoc, & Date
mP.UsedRange.Sort Key1:=Range("AG2"), Order1:=xlAscending, Key2:=Range("P2"), Order2:=xlAscending, Key3:=Range("S2"), Header:=xlYes
'Filters for date range entered in the form
mP.UsedRange.AutoFilter Field:=19, Criteria1:=">=" & Me.txt_Start, Operator:=xlAnd, Criteria2:="<=" & Me.txt_End
'Sets last row on filtered data
mPFRLR = mP.Range("A2:A" & Rows.Count).End(xlUp).Row
'Sets the visible rows as a range
Set mPFR = Cells.SpecialCells(xlCellTypeVisible).Range("A2:AG" & mPFRLR)
'With mPFR
Me.txt_PAppInSLA = WorksheetFunction.CountIfs(mPFR.Range("P:P"), Me.cobo_Assoc, mPFR.Range("T:T"), "Approved", mPFR.Range("AF:AF"), "In SLA")
Me.txt_PAppOutSLA = WorksheetFunction.CountIfs(mPFR.Range("P:P"), Me.cobo_Assoc, mPFR.Range("T:T"), "Approved", mPFR.Range("AF:AF"), "Out of SLA")
'End With
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub