LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Graph As Status Bar

I have set up a simple graph on Sheet1 (i.e. Chart1). I have filled
the series with RAND() functions so that when I calculate the
spreadsheet, the graph updates upon calculate.

When I hit F9 and hold it, the graph moves with the new values
generated by the Rand() functions (like an animation). I now want to
mimic this by sending the graph to a form while in a ForNext loop. So
as I loop, I will have a floating form which shows a graph with
changing values. Kind of like a status bar. Always there showing new
values. So what I have done is tried to use John Walkenbachs code for
charts in userforms. I want to send my chart to a userform while
looping through a variable. The difference here is that I don't have
any buttons on my form and I am only loading one graph. When I try
the code, the userform pops up with the chart, but then stays on the
screen unchanged. The loop does not progress passed the first
increment. If hit the X on the graph and collapse it, the loop
progresses and reloads a new graph. What do I have to do to keep this
userform updating? I am assuming that I have to either put in a Hide
statement or an Unload statement somewhere in the loop. Can anyone
help me with this?

Option Explicit

Sub LoopThing()
Dim X As Double

For X = 1 To 100000
Calculate
ShowChart
Application.StatusBar = X / 100000 * 100 & "%"
Next X
End Sub

Sub ShowChart()
UserForm1.Show
End Sub

Option Explicit

Dim CurrentChart As Chart
Dim Fname As String
Private Sub UserForm_Initialize()
UpdateChart
End Sub

Private Sub UpdateChart()
Set CurrentChart = Sheets("Sheet1").ChartObjects(1).Chart
CurrentChart.Parent.Width = 300
CurrentChart.Parent.Height = 150

' Save chart as GIF
Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"

' Show the chart
Image1.Picture = LoadPicture(Fname)

End Sub
 
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
Combining a 2-D column graph and a 2-D line graph on the same char Filippo Charts and Charting in Excel 3 February 23rd 10 12:34 AM
reuest formula for auto update status & status date PERANISH Excel Worksheet Functions 5 June 2nd 08 04:26 PM
How do I graph data daily as a line graph across a calendar format Glani Charts and Charting in Excel 3 November 23rd 07 09:05 AM
Powerpoint Graph- Shading in between two linear graph lines TerenYoung Charts and Charting in Excel 1 June 15th 06 09:29 AM
Hyperlinkage of one graph with another graph or Drill down graph Sanjay Kumar Singh Charts and Charting in Excel 1 January 3rd 06 12:22 PM


All times are GMT +1. The time now is 03:58 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"