Use wildcard in VBA

krokodilizm

New Member
Joined
Feb 3, 2016
Messages
20
I have a column of invoice numbers that are not consistent. Some are 4 digits, some are 6 digits (they include the year in front, e.g. 16xxxx). The Find and Replace function is limited. How can I employ VBA to locate all cells that start with 16 and remove the two prefixes?
 
That was the original idea, to keep the 4 characters on the right hand side.
Not really what you described though. ;)
.. locate all cells that start with 16 and remove the two prefixes?
Remember that we don't know your sheet or data so we only have what you tell and/or show us. As well as a good description, some sample data and expected results are generally a great help in clarifying what you have and want. :)
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
My thought also. Original post said: remove the two prefixes. Well glad he/she received the help they needed.
Not really what you described though. ;)

Remember that we don't know your sheet or data so we only have what you tell and/or show us. As well as a good description, some sample data and expected results are generally a great help in clarifying what you have and want. :)
 
Upvote 0
My thought also. Original post said: remove the two prefixes. Well glad he/she received the help they needed.
He :) Note it is grammatically wrong to say he/she and then say they. The correct sentence is "Well glad he/she received the help he/she needed". Just saying.
The tendency these days is to use "she" when referring to a hypothetical person. To keep the feminists happy.
 
Last edited:
Upvote 0
Pedantic as it may be.. the REAL correct sentence is

"Well, I'm glad that he or she received the help that he or she needed".
 
Upvote 0

Forum statistics

Threads
1,215,135
Messages
6,123,239
Members
449,093
Latest member
Vincent Khandagale

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