PeterWhitts

asked on

# Deleting text after a number with vba

I am using Excel 2003

I am looking for vba code that will look at a cell and delete all spaces and text after the first occuring string of numbers (this could be any random numbers 100.00 or 10,000 or 0.00 or 0 with or without a decimal point).

Therefore if the cell has "Marketing Area 234.0 plus any text which may include a randum number like 99" what I need is "Marketing Area 234.0"

Therefore if the cell has "Book Plot 9,234 plus any extra text which may include a randum number 102 for example" what I need is "Book Plot 9,234"

Many thanks

I am looking for vba code that will look at a cell and delete all spaces and text after the first occuring string of numbers (this could be any random numbers 100.00 or 10,000 or 0.00 or 0 with or without a decimal point).

Therefore if the cell has "Marketing Area 234.0 plus any text which may include a randum number like 99" what I need is "Marketing Area 234.0"

Therefore if the cell has "Book Plot 9,234 plus any extra text which may include a randum number 102 for example" what I need is "Book Plot 9,234"

Many thanks

ASKER CERTIFIED SOLUTION

membership

Create a free account to see this answer

Signing up is free and takes 30 seconds.

**No credit card required.**
Place this function in a module

ASKER

Thanks for that but it doesn't work for "Book Plot 9,234.00 plus any extra text which may include a randum number 102 for example".

You get the whole string

You get the whole string

SOLUTION

membership

Create a free account to see this answer

Signing up is free and takes 30 seconds.

**No credit card required.**ASKER

Many thanks for the joint answer