FROM and TO Cell References in VBA

D

DOUG

This: =TEXT($L2,"""from"" 0.0""%"";"""" 0.0""%"";""""")&" to
"&TEXT($M2,"0.0%")&","

yields this: from 84.8% to 8451.0%,

I need to have it say: from 84.8% to 84.5%, .

(So, what is the proper way to join parts of a VBA statement together,
anyway)?

Please advise.
DOUG ECKERT
 
D

Don Guillett

Sub putemtogether()
MsgBox "From " & Format(Range("l2"), "00.0%") _
& " to " & Format(Range("m2"), "00.0%")
End Sub
 
L

Luke M

rather than use the TEXT function to insert from/to, it might be simpler to
read if you concatenate them in like so:

ActiveCell.Formula = "=""from ""&TEXT($L2,""0.0%"")& _
"" to ""&TEXT($M2,""0.0%"")&"","""
 
J

Jacob Skaria

With .848 in A1 and .8451 in B1 try the below

="from " & TEXT(A1,"0.0%") & " to " & TEXT(B1,"0.0%")

If this post helps click Yes
 
D

DOUG

Jacob: That yielded "from 8482.0% to 8451.0%". I should preface that by
saying the source cells are expressed as 84.8 and 84.5, not formatted as
percentages. Should I divide by one hundred in the formula?

DOUG ECKERT
 
D

DOUG

Jacob: I guessed right for once! Cell reference over 100 corrected the
formatting problem - er, uh, "challenge".

Thank you so much again.

PS, The VBA instructions for getcolortext still did not work. Advice is
welcome, of course.

Sincerely,
DOUG
 
D

Don Guillett

Did you see my vba instruction. Changed to divide by 100

sub putemtogether()
MsgBox "From " & Format(Range("l2")/100, "00.0%") _
& " to " & Format(Range("m2")/100, "00.0%")
End Sub
 
Top