ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Variable as percent (https://www.excelbanter.com/excel-programming/408262-variable-percent.html)

James C.

Variable as percent
 
Hi everyone,

I have a button that my users can push that will display a message box that
is linked to a cell with a percent value in it. My problem is that when the
user presses the button the msgbox say:

The value of column x is: .158765224

I want this to say, " The value of column x is 15.8%" but i don't know how
to declare my variable properly to do so.

Any help would be appreciated.

JLGWhiz

Variable as percent
 
You can do it in the message box response:

MsgBox "The value of column x is " & Format(LinkedCell, "00.0%")

If you only want whole percentage then make it "00%". Substitute the actual
cell reference for LinkedCell.

"James C." wrote:

Hi everyone,

I have a button that my users can push that will display a message box that
is linked to a cell with a percent value in it. My problem is that when the
user presses the button the msgbox say:

The value of column x is: .158765224

I want this to say, " The value of column x is 15.8%" but i don't know how
to declare my variable properly to do so.

Any help would be appreciated.


Mike

Variable as percent
 
MsgBox Format(Range("B1").Value, "0.0%")

"James C." wrote:

Hi everyone,

I have a button that my users can push that will display a message box that
is linked to a cell with a percent value in it. My problem is that when the
user presses the button the msgbox say:

The value of column x is: .158765224

I want this to say, " The value of column x is 15.8%" but i don't know how
to declare my variable properly to do so.

Any help would be appreciated.



All times are GMT +1. The time now is 12:33 AM.

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