display problem

valex

New Member
Joined
May 12, 2006
Messages
1
Dear All

I have downloaded a progress meter bar from http://www.andypope.info/vba/pmeter.htm and build my calculations inside using a simple straight-line indicator – “Bar”.
Using Step-by-Step “F8” execution on each line it works perfect.
Unfortunately by automatic execution on the whole code the UserForm1 appears on the screen with 0% meter reading and stays the same to finishing calculation. And later disappear.
Does somebody solve a similar problem?

'Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub UserForm_Initialize()
labPg1.Tag = labPg1.Width
labPg1.Width = 0
End Sub

Private Sub CommandButton2_Click()
Application.Cursor = xlWait
DemoProgress1
Application.Cursor = xlDefault
End Sub

Sub Calculate(i)
F = 10 ^i
Ac = GetTLAn(F)
mRes(1, i) = Ac
mRes(0, i) = F
End Sub


Sub DemoProgress1()
Dim intIndex As Integer
Dim sngPercent As Single
Dim intMax As Integer
Dim i As Integer

Size = ND * PD + 1
intMax = Size
For i = BF To ND * PD + 1
intIndex = i
Calculate (i)
sngPercent = intIndex / intMax
labPg1v.Caption = PAD & Format(sngPercent, "0%")
labPg1va.Caption = labPg1v.Caption
labPg1va.Width = labPg1.Width
labPg1.Width = Int(labPg1.Tag * sngPercent)
Application.ScreenUpdating = True
Sleep 10
Next i
Unload Me
End Sub

Private Sub CommandButton1_Click()
Unload Me
End Sub
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Not familiar with this one, but I think you are missing the code line :-

Code:
DoEvents

Where you have ScreenUpdating=True
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,331
Members
452,636
Latest member
laura12345

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