I need to search through a group of cells. Some have an asterisk in them… 53*. I need to delete the asterisk and keep the value in the same cell, I just need the 53 not the 53*. How can I code this in vba? Thanks for the help.
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Take out the asterisk (*) in a cell (Excel xp/win 2000)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Take out the asterisk (*) in a cell (Excel xp/win 2000)
- This topic has 19 replies, 8 voices, and was last updated 22 years, 5 months ago.
Viewing 2 reply threadsAuthorReplies-
WSJohnBF
AskWoody Lounger -
H. Legare Coleman
AskWoody PlusMarch 5, 2002 at 1:30 am #574249John told you how to do this using Find/Replace. If you really need to do it using VBA, the following will remove the first Asterick in all the cells in the current selection. If there can be more than one astherick, or you need some other range that the current selection, it will need to be modified.
Dim oCell As Range Dim iPos As Integer For Each oCell In Selection iPos = InStr(oCell.Value, "*") If iPos > 0 Then oCell.Value = Left(oCell.Value, iPos - 1) & Right(oCell.Value, Len(oCell.Value) - iPos) End If Next oCell
-
WSjha900
AskWoody LoungerDecember 9, 2002 at 8:02 pm #637416is it possible to put this in a formula in excel? I need to check if another cell has a number with an asterisk at the end. i need to change the asterisk to a superior plus sign and leave the number in. in other words, if it is 500* i need to change it to 500+. thanks
also, in another instance i need to see if a + sign is at the end of a cell’s contents i need to put it in the outside of the parens in another cell. so if A10 has 400+ in it, i need to make b10 (400)+. thank you for the help
-
WSsdckapr
AskWoody LoungerDecember 9, 2002 at 8:01 pm #637419There is no way with a formula to change the contents of a cell to something else. If A1 = 500* and you want B1 to be 500+ then this type of formula in B1 will work:
=IF(RIGHT(A1,1)=”*”,LEFT(A1,LEN(A1)-1)&”+”)
If you want A1 to change from 500* to 500+ then you need a macro or find/replace [find: ~*/replace:+]
Steve
-
WSjha900
AskWoody LoungerDecember 9, 2002 at 8:55 pm #637427 -
macropod
AskWoody_MVPDecember 9, 2002 at 9:32 pm #637437Hi jha,
I don’t know what a “superior plus” is, but if you type one into a cell, say A1, and put =code(A1) into another cell, that will return the character’s value. As for changing the asterisk to a +, try:
=SUBSTITUTE(A1,”*”,”+”)
This will replace every “*” in a cell with “+”. If you want to replace only the first asterisk, use:
=SUBSTITUTE(A1,”*”,”+”,1)
or, to replace the second asterisk, use:
=SUBSTITUTE(A1,”*”,”+”,2)
and so on.To replace the asterisk with your “superior plus”, just change the “+” to CHAR(#), where # is the number returned by the CODE(A1) formula referred to earlier. Note too that the “*” and “+” arguments in the SUBSTITUTE formula can be more than one character long, and do not need to be the same length. For example you could have:
=SUBSTITUTE(A1,”*”,CHAR(33)&”+”,1)Cheers
Cheers,
Paul Edstein
[Fmr MS MVP - Word] -
WSWebGenii
AskWoody Lounger -
macropod
AskWoody_MVP -
WSAndrew Cronnolly
AskWoody Lounger -
WSjha900
AskWoody Lounger -
WSsdckapr
AskWoody LoungerDecember 11, 2002 at 7:23 pm #637914If you are superscripting the Plus, the character is still the plus, it is just sperscripted. Some fonts have “superscripted characters” that are different , eg Code 178 is a “superscripted 2” and is NOT a 2 =Code50.
I do NOT think that a “Supercripted +” is a character in a normal font, so it must be superscripted via a macro or manually. It can NOT be done in a formula!
Steve -
macropod
AskWoody_MVPDecember 11, 2002 at 8:23 pm #637926I’m assuming then that when you say ‘superior’ you’re referring to what everyone else here calls superscript. In that case, you do indeed need a macro and one like Steve posted should do fine.
Be aware though that, because you can’t superscript a character returned by a formula, the only way to superscript an individual character in such a cell is by converting its contents into an alpha-numeric string. That means that by running the superscripting macro you lose the formula, if the cell has one.
Cheers
Cheers,
Paul Edstein
[Fmr MS MVP - Word] -
WSJohnBF
AskWoody LoungerDecember 9, 2002 at 10:18 pm #637450See if the attachment to post 144039 is of use, and note the underlying VBA method to produce unicode, courtesy of Rory. OTOH, it may be useless
.
-
WSsdckapr
AskWoody LoungerDecember 9, 2002 at 11:04 pm #637458I assume by “superior +” you mean a “superscripted Plus sign” I know of know character set that has a super+.
If you just have the “500*” entered and you want to change the asterisk to a superscripted + try this code. Highlight the cells to check and it will change all the ending Asterisks to superscripted +.
Steve
Sub AsteriskToSuperiorPlus() Dim rCell As Range Dim iLen As Integer For Each rCell In Selection If Right(rCell.Value, 1) = "*" Then iLen = Len(rCell.Value) rCell.Value = Left(rCell.Value, iLen - 1) & "+" rCell.Characters(Start:=iLen, Length:=1).Font.Superscript = True End If Next End Sub
-
-
-
-
-
WSJohnBF
AskWoody LoungerMarch 5, 2002 at 7:56 pm #574407Legare correctly pointed out that I didn’t answer your request for VBA code. In addition to his code here’s a couple more VBA bits, both require that you select the cells to be operated on before running the macro:
Sub RemoveAllAsterisks()
On Error Resume Next
Selection.Replace What:=”~*”, Replacement:=””
End SubThis one removes only trailing (last in cell contents) asterisks.
Sub RemoveTrailingAsterisk()
Dim rngCell As Range
Dim strCellVal As String
Dim intVLen As Integer
For Each rngCell In Selection
strCellVal = rngCell.Value
If InStr(strCellVal, “*”) > 0 Then
intVLen = Len(strCellVal)
If Right(strCellVal, 1) = “*” Then
rngCell.Value = Left(strCellVal, intVLen – 1)
End If
End If
Next rngCell
End Sub -
WSjha900
AskWoody Lounger -
WSJohnBF
AskWoody Lounger
-
-
WSfburg
AskWoody LoungerMarch 6, 2002 at 3:04 pm #574704John,
Since my Excel VBA isn’t all that great, let me ask the following question with respect to the following part of your code
If InStr(strCellVal, "*") > 0 Then intVLen = Len(strCellVal) If Right(strCellVal, 1) = "*" Then rngCell.Value = Left(strCellVal, intVLen - 1) End If End If
If the 1st If is not successful (ie, no asterisks in cell), next 5 statements skipped. No problem. If there is one or more *’s in the cell, there may be one in the last position (regardless of whether there are any prior to that in the cell). So why is the first If-test even needed and the following intVLen=…? Why not just do the If Right test since that would have to be done if there’s an * anywhere with the code as it exists? Then the rngCell.Value statement could just be:
rngCell.Value = Left(strCellVal, Len(strCellVal) – 1)Thanks for any insights.
Fred
-
WSJohnBF
AskWoody Lounger
-
-
Viewing 2 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Secure Boot Update Fails after KB5058405 Installed
by
SteveIT
4 minutes ago -
Firefox Red Panda Fun Stuff
by
Lars220
4 hours, 34 minutes ago -
How start headers and page numbers on page 3?
by
Davidhs
8 hours, 7 minutes ago -
Attack on LexisNexis Risk Solutions exposes data on 300k +
by
Nibbled To Death By Ducks
2 hours, 42 minutes ago -
Windows 11 Insider Preview build 26200.5622 released to DEV
by
joep517
16 hours, 48 minutes ago -
Windows 11 Insider Preview build 26120.4230 (24H2) released to BETA
by
joep517
16 hours, 49 minutes ago -
MS Excel 2019 Now Prompts to Back Up With OneDrive
by
lmacri
6 hours, 30 minutes ago -
Firefox 139
by
Charlie
20 minutes ago -
Who knows what?
by
Will Fastie
11 hours, 54 minutes ago -
My top ten underappreciated features in Office
by
Peter Deegan
17 hours, 33 minutes ago -
WAU Manager — It’s your computer, you are in charge!
by
Deanna McElveen
11 hours, 56 minutes ago -
Misbehaving devices
by
Susan Bradley
19 hours, 41 minutes ago -
.NET 8.0 Desktop Runtime (v8.0.16) – Windows x86 Installer
by
WSmeyerbos
1 day, 23 hours ago -
Neowin poll : What do you plan to do on Windows 10 EOS
by
Alex5723
1 hour, 54 minutes ago -
May 31, 2025—KB5062170 (OS Builds 22621.5415 and 22631.5415 Out-of-band
by
Alex5723
1 day, 22 hours ago -
Discover the Best AI Tools for Everything
by
Alex5723
21 hours, 15 minutes ago -
Edge Seems To Be Gaining Weight
by
bbearren
1 day, 12 hours ago -
Rufus is available from the MSFT Store
by
PL1
1 day, 20 hours ago -
Microsoft : Ending USB-C® Port Confusion
by
Alex5723
2 days, 23 hours ago -
KB5061768 update for Intel vPro processor
by
drmark
23 hours, 2 minutes ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
21 hours, 45 minutes ago -
My Simple Word 2010 Macro Is Not Working
by
mbennett555
2 days, 18 hours ago -
Office gets current release
by
Susan Bradley
2 days, 21 hours ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
4 days, 11 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
3 days, 20 hours ago -
Stop the OneDrive defaults
by
CWBillow
4 days, 12 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
4 days, 22 hours ago -
X Suspends Encrypted DMs
by
Alex5723
5 days ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
5 days ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
5 days, 1 hour ago
Recent blog posts
Key Links
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.