How to delete a question mark throughout database

  • Thread starter Thread starter TJ
  • Start date Start date
T

TJ

The last answer for my 18,000 record database worked wonders. Now the
problem is that throughout the database, the dataentry person /
transcriber inserted the character '?' most anywhere in the cell where
they were unsure of what they were transcribing. The format should have
been 'lastname, firstname.' Instead throughout I have found 'lastname?,
firstname?' What I would like is for a macro to locate those random ?s
and ask me if I want it deleted and hit enter to make it go away. Any
thoughts? Also, doing a search for the ?s doesn't work since this works
as a wildcard. Any help would be greatly appreciated. TJ
 
TJ

Why do you need code if you are asking each time to delete? Why not just
use find and replace.

To search for a wildcard * or %, prefix with a tilde ~* or ~?

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
www.nickhodge.co.uk
 
Make a backup of your 18000 record database and then make another copy
and test this out on it. Select the cells that you want to search for
the ? in and then run this macro.

Sub Macro2()
Dim r As Range, x As Integer
For Each r In Selection
x = InStr(1, r, "?")
If x > 0 Then
If MsgBox(r & vbCrLf & vbCrLf & "Delete This?", vbYesNo) =
vbYes Then
r = ""
End If
End If
Next r
End Sub

It shows a message box that asks if you want to delete the value. If
you click "Yes" then it empties that cell.

Cheers,
Jason Lepack
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top