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.
![]() |
Patch reliability is unclear, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
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, 4 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 SubWSfburg
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
-
Trying to backup Win 10 computer to iCloud (Awaiting moderation)
by
SheltieMom
22 minutes ago -
Windows 11 Insider Preview build 26200.5570 released to DEV
by
joep517
6 hours, 59 minutes ago -
Windows 11 Insider Preview build 26120.3941 (24H2) released to BETA
by
joep517
8 hours, 47 minutes ago -
Windows 11 Insider Preview Build 22635.5305 (23H2) released to BETA
by
joep517
8 hours, 48 minutes ago -
No April cumulative update for Win 11 23H2?
by
Peobody
11 hours, 6 minutes ago -
AugLoop.All (TEST Augmentation Loop MSIT)
by
LarryK
9 hours, 20 minutes ago -
Boot Sequence for Dell Optiplex 7070 Tower
by
Serge Carniol
1 day ago -
OTT Upgrade Windows 11 to 24H2 on Unsupported Hardware
by
bbearren
1 day, 3 hours ago -
Inetpub can be tricked
by
Susan Bradley
1 day, 5 hours ago -
How merge Outlook 2016 .pst file w/into newly created Outlook 2024 install .pst?
by
Tex265
8 hours, 40 minutes ago -
FBI 2024 Internet Crime Report
by
Alex5723
1 day, 7 hours ago -
Perplexity CEO says its browser will track everything users do online
by
Alex5723
19 hours, 32 minutes ago -
Login issues with Windows Hello
by
CWBillow
1 day, 18 hours ago -
How to get into a manual setup screen in 2024 Outlook classic?
by
Tex265
1 day, 6 hours ago -
Linux : ARMO rootkit “Curing”
by
Alex5723
2 days, 6 hours ago -
Employee monitoring app leaks 21 million screenshots in real time
by
Alex5723
2 days, 6 hours ago -
Google AI is now hallucinating idioms
by
Alex5723
2 days, 7 hours ago -
april update
by
69800
11 hours, 19 minutes ago -
Windows 11 Insider Preview build 27842 released to Canary
by
joep517
2 days, 7 hours ago -
Quick Fix for Slowing File Explorer
by
Drcard:))
2 days, 8 hours ago -
WuMgr not loading?
by
LHiggins
1 day, 3 hours ago -
Word crashes when accessing Help
by
CWBillow
1 day, 12 hours ago -
New Microsoft Nag — Danger! Danger! sign-in to your Microsoft Account
by
EricB
2 days, 7 hours ago -
Blank Inetpub folder
by
Susan Bradley
2 days, 5 hours ago -
Google : Extended Repair Program for Pixel 7a
by
Alex5723
2 days, 18 hours ago -
Updates seem to have broken Microsoft Edge
by
rebop2020
2 days, 4 hours ago -
Wait command?
by
CWBillow
2 days, 11 hours ago -
Malwarebytes 5 Free version manual platform updates
by
Bob99
3 days ago -
inetpub : Microsoft’s patch for CVE-2025–21204 introduces vulnerability
by
Alex5723
3 days, 7 hours ago -
Windows 10 finally gets fix
by
Susan Bradley
3 days, 16 hours ago
Recent blog posts
Key Links
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.