View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
jmdaniel jmdaniel is offline
external usenet poster
 
Posts: 23
Default Search for non alphanumeric characters

Interesting. The macro ran quick, but bolded lines I would not have expected,
like:

73YY26048
73YY26057

as well as didn't bold lines I would have expected:

#1265
#1273
2/3/5103



"Trent Argante" wrote:

This assumes column A from cell 1 to the last working cell in the column.
Adjust the code for your range, if different.

Sub CellBold()
' TPA:20060221T1005E:20060221t1018e
Dim rngRange As Range
Dim strCellRange As String
Dim cel As Variant
Dim intCurrentChar As Integer
Dim i As String

strCellRange = "A1:A" & CStr(ActiveCell.SpecialCells(xlLastCell).Row)
Set rngRange = Range(strCellRange)

For Each cel In rngRange.Cells
For intCurrentChar = 1 To Len(cel.Value)
i = Asc(Mid(cel.Value, intCurrentChar, 1))
If (i 64 And i < 91) Or (i 96 And i < 123) Then
cel.Font.Bold = True
Exit For
End If
Next intCurrentChar
Next

Set rngRange = Nothing
End Sub
--
Trent Argante
[DC.J(n/a)]


"jmdaniel" wrote:

I have a worksheet that has 40K rows of part numbers. As these part numbers
are from different suppliers, they have different formats. We are sending
this information out in Purchase Orders, via EDI, and we receive Error
messages when a non alphanumeric character is included a part number.

Is there a way I can use a macro to look at all of these part numbers, and
perhaps bold the ones that contain one or more non alphanumeric characters? I
have searched high and low, but have not run across a solution to this
(obviously).