ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   FROM and TO Cell References in VBA (https://www.excelbanter.com/excel-discussion-misc-queries/234999-cell-references-vba.html)

Doug

FROM and TO Cell References in VBA
 
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

Don Guillett

FROM and TO Cell References in VBA
 
Sub putemtogether()
MsgBox "From " & Format(Range("l2"), "00.0%") _
& " to " & Format(Range("m2"), "00.0%")
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"DOUG" wrote in message
...
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



Luke M

FROM and TO Cell References in VBA
 
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%"")&"","""

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"DOUG" wrote:

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


Jacob Skaria

FROM and TO Cell References in VBA
 
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 Skaria


"DOUG" wrote:

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


Doug

FROM and TO Cell References in VBA
 
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 Skaria" wrote:

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 Skaria


"DOUG" wrote:

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


Doug

FROM and TO Cell References in VBA
 
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

"Jacob Skaria" wrote:

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 Skaria


"DOUG" wrote:

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


Don Guillett

FROM and TO Cell References in VBA
 

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"DOUG" wrote in message
...
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

"Jacob Skaria" wrote:

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 Skaria


"DOUG" wrote:

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



Jacob Skaria

FROM and TO Cell References in VBA
 
Happy to hear this helped.

If this post helps click Yes
---------------
Jacob Skaria


"DOUG" wrote:

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

"Jacob Skaria" wrote:

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 Skaria


"DOUG" wrote:

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



All times are GMT +1. The time now is 10:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com