test for text

kin

Well-known Member
Joined
Jun 26, 2007
Messages
648
Hello

I d like to test for the existence of text in range D5 to D10000 for example

I may have this 49000897890VGN21SP. VGN21SP is text so I d like to spot it

it may also exist on its own VGN21SP can you suggest me with a macro?

like this one

Sub DeleteNAs()
Dim C As Range
For Each C In ActiveCell.CurrentRegion

If C.Text = "#N/A" Then C.ClearContents

Next C
End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
i d like to find these case with a macro and put it to personal workbook

thanks
 
Upvote 0
What do you want to do with these values once you find them? Also, in which ranges may they appear eg only in column A, B:D or potentially anywhere on the sheet?
 
Upvote 0
Like this?

Code:
Sub DeleteText()
    Dim C As Range
    For Each C In ActiveCell.CurrentRegion
        If Instr(1, C.Value, "VGN21SP") > 0 Then C.ClearContents
    Next C
End Sub
<!-- / message --><!-- sig -->
 
Upvote 0
Alas it cantt be only VGNSP but any other text and my range is D5: D10000
 
Upvote 0
What do you want to do with any such text values when you find them? Are the values in this range that don't contain text genuine numeric values?
 
Upvote 0
yes they ar numbers i convert thme to general or number with no 2 digits (0s) in the end
 
Upvote 0
You could just use conditional formatting to color them? Select your range (in this instance D5:D10000 - easy way to do this is to hit F5 and type in D5:D10000) and go Format>Conditional Formatting and change to Formula Is in the left hand dropdown and use the following formula:

=NOT(ISNUMBER(D5))*(D5<>"")

and then hit the Format and select your color of choice.
 
Upvote 0

Forum statistics

Threads
1,203,082
Messages
6,053,422
Members
444,662
Latest member
AaronPMH

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