Formatting % in vbea messagebox

already

Board Regular
Joined
Nov 11, 2008
Messages
179
Hi

I have to put the results of a percent calculation (A3) in a message box in format '00.00 %'

I use the following code but I can't format the decimal places to only 2 digits

Worksheets("Sheet1").Range("A3") & Format(" %", "0.00")

Thanks in advance for your help.

Kind regards

Al
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Try this:

Rich (BB code):
MsgBox WorksheetFunction.Text(Worksheets("Sheet1").Range("A3"), "00.00%")
 
Last edited:
Upvote 0
Try this:

Rich (BB code):
MsgBox WorksheetFunction.Text(Worksheets("Sheet1").Range("A3"), "00.00%")
No need to call out to the worksheet's TEXT function, you can do that using VB's built-in Format function...

Rich (BB code):
MsgBox Format(Worksheets("Sheet1").Range("A3"), "0.00%")
 
Upvote 0
No need to call out to the worksheet's TEXT function, you can do that using VB's built-in Format function...

Thanks, Rick. With so many function commands available, I just used the first function I could think of that worked in my test macro. I'll try to keep the VBA Format function in mind next time.
 
Upvote 0
Thanks, Rick. With so many function commands available, I just used the first function I could think of that worked in my test macro. I'll try to keep the VBA Format function in mind next time.
Just keep in mind that Format and TEXT are similar, but nowhere near identical... there are major differences between them, but in this simple case (of a percentage format) they produce the same result.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top