Noobie needs help, I'm having a problem with replacing space with stars.
This code is for two functions:
1) Add stars in front and at the end of text
2) Replace space with stars
First function works, but unfortunately the second one is not. It replaces space with stars on all workbook, I want it to replace only on selected cells.
How to replace space with stars on selected range?
- Code: Select all
Sub Stars()
Dim c As Range
For Each c In Selection
If c.Value <> "" Then c.Value = "*" & c.Value & "*"
Sheets(ActiveSheet.Name).Select
Selection.Replace What:=" ", Replacement:="*", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Next
End Sub
Thank you in advance for any help!