Square Root Symbol in VBA

M

MentalDrow

Hello All,

I am looking for a way to include a square root symbol that will display in
a selected cell when the macro is activated. I've looked up the various
ASCII codes (chr(10) is awesome) but have been unable to find the particular
one for the Square Root symbol. If it is available through any other method,
please advise and I will be exceptionally grateful.

Chaz
 
S

SteveW

There isn't an ASCII Code for the Square Root symbol
You'd need a Maths Font for that
 
S

ShaneDevenshire

Hi,

Choose Insert, Symbol, and in the Arial font set you will find √ at 221a,
way down the list.
 
J

John Bundy

Not sure if you wanted it as part of the macro you mentioned but if so here
it is
Sub Radical()
ActiveCell.NumberFormat = ChrW(8730) & "General"
End Sub
 
S

SteveW

That works - but first I couldn't see anything :)

Needs a value in the cell

So is this just a tweak of the "Currency" format ?

Steve
 
M

MentalDrow

Wow,

Looking at the times I got my responses in I have to say "Don't you people
ever sleep?!?" The answer is either "No" or you're in a completely different
time zone. Hee hee.
At any rate, thanks for the quick responses from everyone. It's nice to
know we have e-communities like this where folks are willing to help each
other out.
John, you nailed the solution on the head. While the way you typed it out
isn't 'exactly' what I needed, it pointed me in the right direction.
I took what you gave me and applied in the manner below since I was working
with a range I was merging rather than a singe cell:

ActiveSheet.Range(("A" & FirstRow), ("J" & LastRow)).Select

With Selection
.NumberFormat = "General"
.Merge
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.FormulaR1C1 = "S = " & chrw(8730) & ...

This produced S = √ and the rest of the formula. In the merged cells, I'm
showing the variables and the values the users input for the ones used to
solve for "S". From there I display the formula with just the variables (not
their values). The next line show's how the numbers replace the "empty"
variables and finally the last line shows S = <value>.
I'm using this to develope a calculation sheet using various formulae to
determine the minimum speed a vehicle was traveling based on evidence at an
accident scene. Fun stuff but takes lots of patience. Thanks for all the
help and thanks for being up at what non-shift workers would consider an
"Ungodly" hour.

Chaz
 
M

Martin Fishlock

Steve,

XP has it.

But you can always use the good old character map program (which you may
have to add as it is not added by default in the windows setup process).

In there you can select the root character and then copy it and switch back
to Excel and paste it.

(From Windows Start Menu select All Programs | Accessories | System Tools
and then select Character Map).
 

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