Show decimal as percent

  • Thread starter Thread starter Gizmo
  • Start date Start date
G

Gizmo

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.
 
1. Finish the formula with

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

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

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

- Jon
 
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?
 
Change vbNewLine to vbLf. vbNewLine combines a carriage return (vbCr) and a
line feed (vbLf), but all you need is vbLf. Sorry.

- Jon
 

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