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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel macro

Status
Not open for further replies.

raj00

IS-IT--Management
May 7, 2001
9
0
0
US
Hi

How can I delete a character from a cell in excel sheet using macro? For Example if i have value like #45675 and I want to delete just # sign how can I write macro so that it will take out # sign from each cell.


Thanks
Raj
 
This will work. Add this code to a module.
Select the range of cells you want the char removed from.
Then run this routine.

Sub Remove()

char = InputBox("Enter char to replace")
For Each c In Selection
c.Replace what:=char, replacement:=""
Next c

End Sub

AMM9290
 
Or, if the # is at the fron of all cells, use a formula:
=right(A1,len(a1)-1)
HTH
Geoff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top