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

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
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,224,836
Messages
6,181,251
Members
453,027
Latest member
Lost_in_spreadsheets

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