LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Progress Bar in Cell


The function below is altered using Patricks post above.

I need to display a bar depicting the percentage listed in a cell. I
can pass a value between .1 and 1.0 and the bar will fill that
percentage of the cell.

However, I want to test for the presence of a rectangle and alter the
width of the existing rectangle rather than create another rectangle on
top of an existing one.

I also want to change the font color to white so the "0" that normally
displayed is effectively hidden.

I would appreciate any help with the following;

- How do I test for the presence of the shape in the cell.
- How do I change the width of the cell once I determine a rectangle
already exists?
- How do I set the cell's font color to white to hide the "0" thats
displayed?



Code:
--------------------
Function ProgressBar(percent_fill)
Dim cell As Range
Dim sh As Shape
Set cell = Application.Caller
cell.Select
x = 0 'Used to force condition for now

'Set font color
cell.Font.Color = RGB(255, 255, 255)

'Calculate percentage of cell to fill in
cwidth = cell.width * percent_fill

'Check if a shape is already present (How do I test for the shape?)
If x = 0 Then

'If not create the shape to desired width (This seems to work)
ActiveSheet.Shapes.AddShape(msoShapeRectangle, cell.Left, cell.Top, cwidth, cell.Height).Select
With Selection
.ShapeRange.Fill.ForeColor.SchemeColor = 30
.ShapeRange.Fill.Visible = msoTrue
.ShapeRange.Fill.Solid
.Name = "PB" & cell.Name
End With

Else
'If so, alter the width of the existing shape (Not working)
Set sh = ActiveSheet.Shapes("PB" & cell.Name)
sh.width = 0
sh.width = cwidth
End If

End Function
--------------------


Any help would be appreciated.


--
markyharris
------------------------------------------------------------------------
markyharris's Profile: http://www.excelforum.com/member.php...o&userid=24823
View this thread: http://www.excelforum.com/showthread...hreadid=381866

 
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
Tracking progress and coloring numbers in a cell Dave O. Excel Discussion (Misc queries) 1 December 28th 06 08:19 AM
Progress Bar Jenny Excel Programming 5 October 13th 04 09:45 AM
Data Entry in a cell still in progress - how to detect and correct Paul Willman Excel Programming 0 June 29th 04 10:25 PM
Progress Bar Syed Zeeshan Haider[_7_] Excel Programming 2 May 21st 04 01:33 PM
Progress Bar Help Malcolm Excel Programming 2 November 21st 03 02:29 PM


All times are GMT +1. The time now is 09:45 AM.

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

About Us

"It's about Microsoft Excel"