ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to replace * with / (https://www.excelbanter.com/excel-programming/312578-macro-replace-%2A.html)

[email protected]

Macro to replace * with /
 
Well here's a rather embarassing problem.

I sent out about a kazillion files for people to enter information in
and one of the columns has a =Cell*12 in it where cell is the cell
address over dozens of rows (e.g.

=aa10*12
=aa11*12
etc.

I thought it would be simple to do a record macro to replace the * with
a / but something that I thought would be trival has escaped me....
any help would be appreciated.


Tom Ogilvy

Macro to replace * with /
 
to replace *, you would use ~*

Sub Macro5()
Cells.Replace What:="~*", Replacement:="/", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub


--
Regards,
Tom Ogilvy



" wrote in message
ups.com...
Well here's a rather embarassing problem.

I sent out about a kazillion files for people to enter information in
and one of the columns has a =Cell*12 in it where cell is the cell
address over dozens of rows (e.g.

=aa10*12
=aa11*12
etc.

I thought it would be simple to do a record macro to replace the * with
a / but something that I thought would be trival has escaped me....
any help would be appreciated.




kkknie[_204_]

Macro to replace * with /
 

Excel hates searching for a wild card...

One way I know is to create a macro to do it. In the VB editor, inser
a module and enter the following code:

Sub Repl()

Dim c As Range
Application.ScreenUpdating = False
For Each c In ActiveSheet.UsedRange
c.Formula = Replace(c.Formula, Chr(42), "/")
Next

End Sub

Then from the sheet you wish to search and replace, select Tools
Macro -- Macros and then select that macro from the list.

Don't know of a better way... Sorry.



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26661


kkknie[_205_]

Macro to replace * with /
 

Aha!

You don't even need to write code. Just type in ~* in the find and
in the replace for a find/replace dialog (with all cells selected).

Is that escape character documented anywhere???



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26661


[email protected]

Macro to replace * with /
 
I needed code because there are something like 1200 files that are
already in the hot hands of others that I needed to be able to make the
change to. Using a macro allows me to send a folks a method that can
automatically open their files and make the change. Not to mention,
that doing this to 1200 files by hand would have been tiresome



All times are GMT +1. The time now is 01:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com