View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Hightlight cells that contain special characters

Per your request. 0-9, a-z, A-Z and full stop.

Sub Color_Non_Standard()
Dim intI As Integer
Dim rngR As Range, rngRR As Range
Dim strNotNum As String, strTemp As String
Set rngRR = Selection.SpecialCells(xlCellTypeConstants, _
xlTextValues)
For Each rngR In rngRR
strTemp = ""
For intI = 1 To Len(rngR.Value)
If Not Mid(rngR.Value, intI, 1) Like "[A-Z,a-z,0-9,.]" Then
rngR.Interior.ColorIndex = 3
End If
Next intI
Next rngR
End Sub


Gord

On Fri, 5 Feb 2010 01:54:01 -0800, Gareth_Evans (InterCall EMEA)
m wrote:

Hi Gord, thank you for your reply and sorry for not defining correctly.

The name strings in the two columns, first & last name, can't contain any
characters other than A-Z, a-z, 0-9. No accented characters or symbols. I'd
like to identify these entries with some type of marker so they can be
manually checked.

I'm not looking to auto replace them, just identify them - possibly with a
cell highlight but open to suggestions.

The system we load these names into doesn't support uni-code (yet) and we
get failures on large sheets due to this (we sometimes miss them on the
manual check).

From your instructions I've used =CHAR(ROW()), it's probably easier to list
the one's we'd like to allow as this is a smaller list.

Rows: 46 (full stop), 48-57 (0-9), 65-90 (A-Z) and 97-122 (a-z)

Not quite a sequential series, but could these be grouped maybe?

Thank you for your time, it really is appreciated.

Kind regards,

Gareth