ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Show decimal as percent (https://www.excelbanter.com/excel-discussion-misc-queries/183592-show-decimal-percent.html)

Gizmo

Show decimal as percent
 
Excel2003

I am using the following code to add a record to my collection page.

Dim LP1C1ARNU As Double
....
....
Range("D" & LRow - 1).Value = LComments1 & " " & LRun & " " & "P1C1AR" & "="
& LP1C1AR & " " & "P1C1ARNU" & "=" & LP1C1ARNU

LP1C1ARNU is from another page in percent format, but shows up in the new
cell as a Decimal.(ex P1C1ARNU=.157)
How can I show it as Percentage?(ex P1C1ARNU=15.7%)

I would also like to know how to add "alt enter" to the expression so I can
line up the values in the cell.

Jon Peltier

Show decimal as percent
 
1. Finish the formula with

"P1C1ARNU" & "=" & Format(LP1C1ARNU, "0.0%")

2. For a new line, include the character vbNewLine:

.... & vbNewLine & "P1C1ARNU" & "=" & LP1C1ARNU

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Gizmo" wrote in message
...
Excel2003

I am using the following code to add a record to my collection page.

Dim LP1C1ARNU As Double
...
...
Range("D" & LRow - 1).Value = LComments1 & " " & LRun & " " & "P1C1AR" &
"="
& LP1C1AR & " " & "P1C1ARNU" & "=" & LP1C1ARNU

LP1C1ARNU is from another page in percent format, but shows up in the new
cell as a Decimal.(ex P1C1ARNU=.157)
How can I show it as Percentage?(ex P1C1ARNU=15.7%)

I would also like to know how to add "alt enter" to the expression so I
can
line up the values in the cell.




Gizmo

Show decimal as percent
 
vbNewLine is adding a box symbol to my text. I tried using Chr (10) instead
and that works better. No extra characters.

Cell contents from record sheet:
Testing New Code that adds percent symbol to record and alignes text into 6
lines
Run #27
P1C1AR=10000 P1C1ARNU=4.22% P1C1K=500.84% P1C1RNG=667
P1C2AR=10000 P1C2ARNU=4.22% P1C2K=500.84% P1C2RNG=1000
P2C1AR=0 P2C1ARNU=0.00% P2C1K=0.00% P2C1RNG=0
P2C2AR=10000 P2C2ARNU=4.22% P2C2K=500.84% P2C2RNG=1000
P3C1AR=0 P3C1ARNU=0.00% P3C1K=0.00% P3C1RNG=0
P3C2AR=10000 P3C2ARNU=4.22% P3C2K=500.84% P3C2RNG=1000


OK. I just discovered that when I tried to paste an example of the extra
characters into this reply, they were gone. They still show on my record
sheet though.

I'll describe what i'm seeing:
When looking at the text in the cell, i see a verticle line one the end of
each row of text.
When looking at the formula bar with the cell selected I see a small box at
the end of each row of text.

Does this make any sense?

"Jon Peltier" wrote:

1. Finish the formula with

"P1C1ARNU" & "=" & Format(LP1C1ARNU, "0.0%")

2. For a new line, include the character vbNewLine:

.... & vbNewLine & "P1C1ARNU" & "=" & LP1C1ARNU

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Gizmo" wrote in message
...
Excel2003

I am using the following code to add a record to my collection page.

Dim LP1C1ARNU As Double
...
...
Range("D" & LRow - 1).Value = LComments1 & " " & LRun & " " & "P1C1AR" &
"="
& LP1C1AR & " " & "P1C1ARNU" & "=" & LP1C1ARNU

LP1C1ARNU is from another page in percent format, but shows up in the new
cell as a Decimal.(ex P1C1ARNU=.157)
How can I show it as Percentage?(ex P1C1ARNU=15.7%)

I would also like to know how to add "alt enter" to the expression so I
can
line up the values in the cell.





Jon Peltier

Show decimal as percent
 
Change vbNewLine to vbLf. vbNewLine combines a carriage return (vbCr) and a
line feed (vbLf), but all you need is vbLf. Sorry.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Gizmo" wrote in message
...
vbNewLine is adding a box symbol to my text. I tried using Chr (10)
instead
and that works better. No extra characters.

Cell contents from record sheet:
Testing New Code that adds percent symbol to record and alignes text into
6
lines
Run #27
P1C1AR=10000 P1C1ARNU=4.22% P1C1K=500.84% P1C1RNG=667
P1C2AR=10000 P1C2ARNU=4.22% P1C2K=500.84% P1C2RNG=1000
P2C1AR=0 P2C1ARNU=0.00% P2C1K=0.00% P2C1RNG=0
P2C2AR=10000 P2C2ARNU=4.22% P2C2K=500.84% P2C2RNG=1000
P3C1AR=0 P3C1ARNU=0.00% P3C1K=0.00% P3C1RNG=0
P3C2AR=10000 P3C2ARNU=4.22% P3C2K=500.84% P3C2RNG=1000


OK. I just discovered that when I tried to paste an example of the extra
characters into this reply, they were gone. They still show on my record
sheet though.

I'll describe what i'm seeing:
When looking at the text in the cell, i see a verticle line one the end of
each row of text.
When looking at the formula bar with the cell selected I see a small box
at
the end of each row of text.

Does this make any sense?

"Jon Peltier" wrote:

1. Finish the formula with

"P1C1ARNU" & "=" & Format(LP1C1ARNU, "0.0%")

2. For a new line, include the character vbNewLine:

.... & vbNewLine & "P1C1ARNU" & "=" & LP1C1ARNU

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Gizmo" wrote in message
...
Excel2003

I am using the following code to add a record to my collection page.

Dim LP1C1ARNU As Double
...
...
Range("D" & LRow - 1).Value = LComments1 & " " & LRun & " " & "P1C1AR"
&
"="
& LP1C1AR & " " & "P1C1ARNU" & "=" & LP1C1ARNU

LP1C1ARNU is from another page in percent format, but shows up in the
new
cell as a Decimal.(ex P1C1ARNU=.157)
How can I show it as Percentage?(ex P1C1ARNU=15.7%)

I would also like to know how to add "alt enter" to the expression so I
can
line up the values in the cell.








All times are GMT +1. The time now is 10:59 AM.

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