Wild Card for If Statements in VBA

Tuffman

New Member
Joined
May 31, 2012
Messages
49
Office Version
  1. 2016
Platform
  1. Windows
I would like to just set the If statement equal to "Ford" rather than "Ford Mustang". Is there a way to make what I'm searching for a wild card?

If Worksheets("Car Design").Cells(RowNum2, 10).Value = "Ford Mustang" Then
Worksheets("Car Quick Reference View").Cells(10, ColNum) = Worksheets("Car Design").Cells(RowNum2, 11)
End If
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
How about:
VBA Code:
If Left(Worksheets("Car Design").Cells(RowNum2, 10).Value,4) = "Ford" Then
 
Upvote 0
You can use instr to find if a string of characters exists:
VBA Code:
If InStr(LCase(Worksheets("Car Design").Cells(rownum2, 10)), "ford") > 0 Then
    Worksheets("Car Quick Reference View").Cells(10, ColNum) = Worksheets("Car Design").Cells(rownum2, 11)
End If
 
Upvote 0
Solution

Forum statistics

Threads
1,226,730
Messages
6,192,705
Members
453,748
Latest member
akhtarf3

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