Excel 2007 AutoShape Text - Format as Percentage?

sthrncaliguy

Board Regular
Joined
Jul 28, 2009
Messages
213
I am using an autoshape as a progress bar in Excel 2007, and my macro effecectively resizes my rectangle from 0-100% based on the progress through my routine, and I added a line of code that actually writes the percantage into the Rectangles text field, but I can't figure out how to format the text string as a percentage...

Since I am using a variable to load text into the box, without formatting its showing up like this: 6.213545312 when I am at that percentage progress..

I would like it to show up as 6.21%

Is this possible??
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Perhaps:-
Code:
Dim p As String
p = "6.123456789"
ActiveSheet.Shapes("Rectangle 4").OLEFormat.Object.Text = Format(p / 100, "0.00%")
 
Upvote 0
You could just write a macro that can run after the routine and select the range needed and reformat. let me know if you need an example (im not on a computer with excel right now but can write it for you later)
 
Upvote 0

Forum statistics

Threads
1,224,578
Messages
6,179,654
Members
452,934
Latest member
mm1t1

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