myFind Range not working

Darren Smith

Well-known Member
Joined
Nov 23, 2020
Messages
631
Office Version
  1. 2019
Platform
  1. Windows
Please can someone say why this myFindRng goes red in the code?

VBA Code:
Private Sub Model_Chose_Change()

With ThisWorkbook.Worksheets("Job Card Master")

Me.Quote_Details.ListIndex = Me.Model_Chose.ListIndex
myValToFind = Make_Chose.Value
Set mySearchRng = .Columns("A")
End With

Set myFindRng = mySearchRng.Find(What:=myValToFind, _
           LookIn:=xlFormulas, _
           LookAt:=xlWhole, _
           SearchOrder:=xlByRows, _
           SearchDirection:=xlNext, _
           MatchCase:=False)
 
Last edited:
The problem is more likely to be with myFindRng and is probably because in the preceding code Find failed to find what you were searching for.
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Sorry about this how can I make this work.
The issue is the myFindRng.
The value in the Combo box and Listbox are the same.
There are quite a number of lines with the same value in Column B in the source worksheet just needs to grab the whole lot.
With the value in column B in the Source worksheet
Then display the lot in the Listbox.
 
Last edited:
Upvote 0
How are you populating the combobox?
 
Upvote 0
How are you populating the combobox?
like this

With Me.Model_Chose
Me.Model_Chose.Clear

.AddItem "Transit"
.AddItem "Movano"
.AddItem "Master"
.AddItem "NV400"
.AddItem "Boxer"
.AddItem "Relay"
.AddItem "Ducato"
.AddItem "Sprinter"
.AddItem "Grafter"

End With


End Sub
 
Upvote 0
I suggest you repost your full routine that is causing the problem.
 
Upvote 0
How can I because other times I`ve done that I got told I can`t repost the same post?
 
Upvote 0
I just mean post your code in this thread, not start a new question. The code in your original question didn't include the last part you said had a problem.
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,812
Members
449,095
Latest member
m_smith_solihull

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