Formating percentage in macro

O

orquidea

Hi

In the below subprocedure I want to format Saskour20per with %. This result
Saskour20per will be placed in different cells depending of some if
conditions, therefore I can't set a Range("A1") for example.

Saskour20per = (saskour20 / sask20)
How could I do that.

Thanks in advance.
Orquidea
 
F

FSt1

hi
you didn't say how many cells or which cells so.......
format each cell you put it in......
Range("A1").Value = saskour20per
Range("A1").NumberFormat = "0.00%"
Range("B2").Value = saskour20per
Range("B2").NumberFormat = "0.00%"
Range("C3").Value = saskour20per
Range("C3").NumberFormat = "0.00%" each cell you put it in....
if you are working with variables just substitute the range address with
the variable.

REgards
FSt1
 
O

orquidea

Hi

Thanks for your answer. As I am working with variables I susbstituted the
range address with the variable but I get the error message "invalid
qualifier" and it highlights the underlined statement.

If sask20 <> 0 Then
Saskour20per.Value = (saskour20 / sask20)
--------------------------
Saskour20per.NumberFormat = "0.00%"

Could you please tell me where I am making an error?

Thanks in advance
Orquidea
 

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

Top