LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default Hightlight cells that contain special characters

I've managed to get the following VBA code from another user and ameded
slightly for my use - this brings up a text box which shows the cell
reference and contents in a pop up message box.

Is there a way I can replace "'find é in text" with a generic statement
which checks for all characters that aren't A-Z, a-z 0-9? The only other
alternative would be to type them all out?

How can I highlight a cell containing one of these un-required characters
with a yellow background (or any colour) instead of it popping up in a
message box?

Best regards,

Gareth

Sub FindCellsWithAsterisks()
'find é in text
Dim cell As Range, FirstAddress As String, FoundList As String
With ActiveSheet.UsedRange
'use tilde to find é
Set cell = .Find("~é", LookIn:=xlValues, SearchOrder:=xlByRows, _
LookAt:=xlPart)
If Not cell Is Nothing Then
FirstAddress = cell.Address '< Bookmark start point
Do
FoundList = FoundList & "Cell " & cell.Address(0, 0) & _
" =" & vbTab & cell & vbNewLine
Set cell = .FindNext(cell)
Loop Until cell Is Nothing Or cell.Address = FirstAddress
End If
End With
'show search results
MsgBox FoundList
Set cell = Nothing
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format cells for special characters Mad Davy Cash New Users to Excel 1 March 8th 07 09:51 PM
Format cells for special characters John Bundy New Users to Excel 0 March 8th 07 07:05 PM
Automatically highlight cells with special characters Matt B. Excel Discussion (Misc queries) 3 December 20th 06 11:58 PM
special characters (little box) YuChieh Excel Discussion (Misc queries) 9 June 14th 05 01:41 PM
REMOVE SPECIAL CHARACTERS FROM TEXT CELLS javila255 Excel Worksheet Functions 1 April 2nd 05 06:24 PM


All times are GMT +1. The time now is 08:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"