Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 132
Default Formating percentage in macro

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Formating percentage in macro

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

"orquidea" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 132
Default Formating percentage in macro

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

"FSt1" wrote:

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

"orquidea" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro fails to produce Category Name and Percentage values - Pie C Jay Charts and Charting in Excel 5 June 19th 09 09:24 AM
Conditional formating or Macro code [email protected] Excel Discussion (Misc queries) 3 June 14th 07 04:30 PM
How to program a macro to hide rows with conditionnal formating Turquoise_dax Excel Discussion (Misc queries) 5 June 20th 06 04:33 PM
Inserting and Formating Variables in a Header using a macro Strabo Excel Discussion (Misc queries) 0 March 14th 06 05:07 PM
formating macro vishu Excel Discussion (Misc queries) 6 June 15th 05 01:02 PM


All times are GMT +1. The time now is 01:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"