Find Function Not Working

reberryjr

Well-known Member
Joined
Mar 16, 2017
Messages
712
Office Version
  1. 365
Platform
  1. Windows
I'm not sure why, but this code isn't finding instances where a formula result in column T is "Reviewer Level Conflict". The last row is identified correctly, and I've verified that the value is present.

Code:
Private Sub cmd_Create1LRFiles_Click()
Dim mws2 As Worksheet
Dim rng, rngFound As Range
Set mws2 = ThisWorkbook.Sheets("Active_Inv")
mLastRow2 = mws2.Range("U" & Rows.Count).End(xlUp).Row
Set rng = Range("T" & mLastRow2)
Set rngFound = rng.Find("Reviewer Level Conflict", LookIn:=xlValues)
If mws2.FilterMode Then
    mws2.ShowAllData
Else
End If
If rngFound Is Nothing Then
    Call AssignChristina1LPLoans
    Call AssignDebra1LPLoans
    Call AssignChelsea1LPLoans
    Call AssignKrista1LPLoans
    Call AssignGladys1LPLoans
    Call AssignKat1LPLoans
    Call AssignNicky1LPLoans
    Call AssignPomona1LPLoans
    
    If mws2.FilterMode Then
        mws2.ShowAllData
    Else
    End If
    Unload Me
    MsgBox "First level review files have been created."
Else
    With mws2
        .UsedRange.AutoFilter Field:=20, Criteria1:="Reviewer Level Conflict"
    End With
    Unload Me
    MsgBox "The 1st and 2nd level Reviewer cannot be the same person.  Please make the necessary corrections."
End If
End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi.

What if you do
Code:
mws2.ShowAllData
BEFORE
Code:
rng.Find(...)
 
Last edited:
Upvote 0
The test data isn't filtered, but I tried it anyways...to no avail.
 
Upvote 0
Are you saying this needs to loop, I cent see where that is happening.

for each rngfound in rng or something similar
 
Upvote 0
I wouldn't think it needs to loop, but I could be crazy. It's just looking for one instance where the value is found.
 
Upvote 0
Your right,

In that case, I think you are only looking at one cell with this Set rng = Range("T" & mLastRow2)
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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