FROM and TO Cell References in VBA

  • Thread starter Thread starter DOUG
  • Start date Start date
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
 
Sub putemtogether()
MsgBox "From " & Format(Range("l2"), "00.0%") _
& " to " & Format(Range("m2"), "00.0%")
End Sub
 
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%"")&"","""
 
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
 
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
 
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
 
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
 

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

Back
Top