View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default how do I use macro to find and replace unicode characters

You don't integrate it with what the macro recorder gave you... forget what
the macro recorder gave you... delete it and copy/paste my macro in its
place. Oh, and change the sheet name I used (Sheet6) in the With statement
to the name of the worksheet where your data at... then, just run the macro
and it should replace the three symbols you showed me (•›, •œ and •) with the
numbers .25, .5 and .75 wherever they appear on the worksheet.

--
Rick (MVP - Excel)


"CliffG" wrote in message
...
Hey Rick,

I certainly would give it a try, if I had a clue. I can generally follow a
script, but I'm not a programer. I don't know how to integrate your
script
with what I'm trying to do. Here the macro that Excel produced when I
recorded it:

Sub Macro8()
Selection.Replace What:="+", Replacement:=".75", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="+", Replacement:=".5", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="+", Replacement:=".25", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.NumberFormat = "0.00"
End Sub

If you could please step me through how I need to use your script, I would
greatly appreciate it.

Thanks,

Cliff

"Rick Rothstein" wrote:

Give this macro a try...

Sub ConvertSymbolsToValues()
Dim X As Long
Dim C As Range
With Worksheets("Sheet6").UsedRange
For X = 1 To 3
Set C = .Find(What:=ChrW(9562 + X), LookAt:=xlPart)
If Not C Is Nothing Then
Do
C.Value = Replace(C.Value, ChrW(9562 + X), X / 4)
Set C = .FindNext(C)
Loop While Not C Is Nothing
End If
Next
End With
End Sub

--
Rick (MVP - Excel)


"CliffG" wrote in message
...
Absolutely :)

•› U+255B .75
•œ U+255C .50
• U+255D .25


"Rick Rothstein" wrote:

I'm pretty sure we can write a macro for you ... can you post the
conversion
chart (Unicode character numbers against the fractional values you
want
it
to be)?

--
Rick (MVP - Excel)


"CliffG" wrote in message
...
Thanks in advance for your help.

In the original database the symbols represented fractions, i.e., ΒΌ,
Β½,
or
ΒΎ. I replace these with their decimal equivilents .25, .50, .75.
They
are
contained in two columns only, in this case G and I. I basically
want
save
it in that format. The saved spreadsheet is ultimately imported
into
another
database.

As I mentioned, I can do it fine by pasting the symbols from
character
map
into "find" and typing in their replacement values. I can save the
spreadsheet, import it later, everything is right. When I try to
record
the
steps in the macro, it just doesn't record it correctly. When I run
the
macro it doesn't find anything to replace because it's looking for
"+"
instead of the symbols.

Thanks again.

"Rick Rothstein" wrote:

Can you give us a hint of what you want to replace them with? You
say
"numbers"... what numbers and how are the numbers related to the
symbols
(for example, are they their ASCII code)? Is replacing them with
numbers
all
you want to do to them, or is that in intermediate step on the way
to
some
other functionality? Also, are these symbols confined to specific
columns
(if so, which ones) or can they be anywhere within your data?

--
Rick (MVP - Excel)