Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing asterisks in Excel 3

Status
Not open for further replies.

Petzl

Technical User
Jul 10, 2002
114
AU
I have a scenario where the customer has a column with people's names in it but it was exported from a legacy system. It has an asterisk at the front of the name so the name appears as *Bob Smith. I know how to get the name with formula's but I wanted an easier way by using the edit replace functionality in Excel. Trouble is if you ask Excel to find * and replace with nothing, it assumes the * is a wildcard and deletes the whole field!

Any way around that???

Thank!
 
add a tilda to indicate literal character
ie
~*

;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
The faqs ma'am, just the faqs. Get the best from these forums : faq222-2244
 
Hi,

You could do this with VBA code as follows;

Code:
Public Sub Asterisk()

Sheet1.Select
Cells(2,1).Select 'Cell A2

Do

    If Left(ActiveCell) ,1) = "*" Then

        ActiveCell.Value = Right(ActiveCell, Len(ActiveCell)-1)

        ActiveCell.Offset(1, 0).Select

    Else

        ActiveCell.Offset(1, 0).Select

Loop Until IsEmpty(ActiveCell) = True

End Sub

Copy this code to a module and run it, but change the sheet and cell ref to suit your workbook.

Hope this helps.


Leigh Moore
Solutions 4 MS Office Ltd
 
Ask excel to find ~* and replace by nothing.

combo
 
That simple!!! Knew there had to be something!

Thanks guys!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top