Removing characters with VBA

paulsolar

Well-known Member
Joined
Aug 21, 2013
Messages
696
Office Version
  1. 365
Hi All

I thought this was going to be easy to accomplish but I'm having a lot of trouble with it.

I have a long list of postcodes, in the UK postcodes come in quite a few formats but i just want to achieve a simple thing.

Postcodes can look like the below:

NP12 9AF
NP126AF
CF32 9PP
B1 9AA

I only need the letters before the first number, so my new list would look like the below

NP
NP
CF
B

I'm sure there must be an easy way of doing this but cant seem to come up with a simple solution

Any help is greatly appreciated.

Cheers

Paul
 
Hi Rick

i was just finishing up for the night when your reply was posted, but:

I couldn't resist trying it as I didn't think it was possible to do this with such a short bit of code. I thought Fluffs was short, but credit where it's due you have reduced it to the essentials. Spot on it works brilliantly

thanks to everyone for taking the time to look.

Kind regards

Paul
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

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