Excel 'Arrow' Symbol - Coding Help

T

tommo_blade

Hi,
I am dynamically creating a spreadsheet using a Perl program, I
simply create a <TAB> delimmited file with a .xls extension, when
opened I have the basic requirements of my excel spreadsheet, there is
one piece of information that I cannot replicate and that is how I can
force the Excel 'up arrow' symbol (character code 2193) in the
spreadsheet, simply putting 2193 does not represent an 'up arrow' when
the spreadsheet is opened, it reads '2193' literally - do I have to
quote it or something else or is it even possible...

help appreciated, Mark.
 
P

Peter T

Character code hex 2193 is a down arrow, subject Font and not particularly
an "Excel" arrow

Using VBA

Range("A1").Value = ChrW(&H2191)
Range("A2").Value = ChrW(8593)

other arrows from 8592 to 8597

Regards,
Peter T
 
T

tommo_blade

I dont seem to be able to force that same VBA code to be interpreted
as an arrow when the spreadsheet is opened, do you know if I can use
some other character like a "£" symbol and then do a replace on the
"£" for an 'up arrow' once the spreadsheet is opened.

cheers.
 
P

Peter T

Explain what you mean in the first part of your sentence.

As for the second part, you could use (ie programmatically) Excel's own find
and replace method, but I don't follow why you'd need to do that.

Regards,
Peter T

I dont seem to be able to force that same VBA code to be interpreted
as an arrow when the spreadsheet is opened, do you know if I can use
some other character like a "£" symbol and then do a replace on the
"£" for an 'up arrow' once the spreadsheet is opened.

cheers.
 
T

tommo_blade

what I mean is that I have tried writing <Range("A1").Value =
ChrW(&H2191)> to a text file and then opening that file with Excel,
the cell A1 just shows the command literally rather than interpreting
it as a function and showing the arrow. I am obviously doing something
stupid but I guess I need it pointing out.

cheers.
 
P

Peter T

The code snippet I suggested is for use in a VBA macro, absolutely not
intended to be written to a text file.

If you are writing your file as text, to cater for your special character
you'll need to write in double byte or 'wide character' Unicode. I have no
idea how you would do that in Pearl (not sure in VBA either, Rick if you are
looking ?)

Perhaps it's easier to do what you had in mind, save say a £ character and
replace with your special character with an Excel macro.

Sub RepChar()
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
ws.Cells.Replace What:="£", Replacement:=ChrW(&H2191), LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False
Next

End Sub
Sub Macro

Post back if you don't know what to do with this (don't save it to a text
file!)

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top