cortiz1bog
10-18-2005, 05:24 AM
I have the following code for the Userform:
Private Sub UserForm_Activate()
Dim N&
'*******PROPERTIES*******
With UserForm1
'(set form properties)
.Height = 120
.Width = 380
.Caption = "My Progress Indicators"
End With
With ProgressBar1
'(set prog.bar1 properties)
.Height = 15
.Width = 355
.Left = 10
.Top = 30
.Min = 0
.Max = 40
.Scrolling = ccScrollingStandard
End With
With Label1
'(set label1 properties)
.Height = 15
.Width = 130
.Left = 10
.Top = 15
End With
'*******PROGRESS********
For N = 1 To 40
ProgressBar1 = N
Label1 = "Individual Progress = " & N * 2.5 \ 1 & "%"
DoEvents
Next N
Unload Me
End Sub
For the module:
Private Sub AddReference()
On Error Resume Next '< error = reference already set
'set reference to Microsoft Windows Common Controls 6.0 (SP4)
'(aka: Microsoft Progress Bar Control 6.0 (SP4))
ThisWorkbook.VBProject.References.AddFromGuid _
"{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}", 2, 0
End Sub
Sub ShowForm()
Call AddReference
UserForm1.Show
End Sub
Now, I know that I have to:
"To give the progress of the procedure you're running, you will need to put a reference to the value of the progress indicator at the points in your code where you want the progress to be updated. "
This is where I need help, can somebody point in the right direction and show what and where do I need to put "Some code" in the following procedure to make the two codes work together.
Sub InfoFinal102()
Application.ScreenUpdating = False
ShowForm
'HERE GOES 0 % PROGRESS ? WHAT AND HOW?'
'N = 0'
Sheets("FACTURA").Select
Range("T184:AB184").Select
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Range("F65536").Select
Selection.End(xlUp).Select
'HERE GOES 25% PROGRESS '
'N = 25 % ?'
Sheets("EGRESOS").Select
Range("AP183:BR183").Select
Application.CutCopyMode = False
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Range("N65536").Select
Selection.End(xlUp).Select
'HERE GOES 50 % PROGRESS '
'N = 50 % ?'
Sheets("TURNOS").Select
Range("V211:AE211").Select
Application.CutCopyMode = False
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Range("G65536").Select
Selection.End(xlUp).Select
'HERE GOES 75 % PROGRESS '
'N = 75 % ?'
Sheets("IMPTOS").Select
Range("L3:Y3").Select
Application.CutCopyMode = False
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Range("B65536").Select
Selection.End(xlUp).Select
'HERE GOES 100 % PROGRESS '
'N = 100 % ?'
MsgBox "AHORA EL PROGRAMA FUNCIONARA RAPIDO - SU LIBRO DE TRABAJO NO ES TAN PESADO - BUENA LABOR HA HECHO HOY - HASTA PRONTO", vbInformation
Application.ScreenUpdating = True
ActiveWorkbook.Sheets("BOTONES").Activate
End Sub
Thank you
Cesar
Private Sub UserForm_Activate()
Dim N&
'*******PROPERTIES*******
With UserForm1
'(set form properties)
.Height = 120
.Width = 380
.Caption = "My Progress Indicators"
End With
With ProgressBar1
'(set prog.bar1 properties)
.Height = 15
.Width = 355
.Left = 10
.Top = 30
.Min = 0
.Max = 40
.Scrolling = ccScrollingStandard
End With
With Label1
'(set label1 properties)
.Height = 15
.Width = 130
.Left = 10
.Top = 15
End With
'*******PROGRESS********
For N = 1 To 40
ProgressBar1 = N
Label1 = "Individual Progress = " & N * 2.5 \ 1 & "%"
DoEvents
Next N
Unload Me
End Sub
For the module:
Private Sub AddReference()
On Error Resume Next '< error = reference already set
'set reference to Microsoft Windows Common Controls 6.0 (SP4)
'(aka: Microsoft Progress Bar Control 6.0 (SP4))
ThisWorkbook.VBProject.References.AddFromGuid _
"{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}", 2, 0
End Sub
Sub ShowForm()
Call AddReference
UserForm1.Show
End Sub
Now, I know that I have to:
"To give the progress of the procedure you're running, you will need to put a reference to the value of the progress indicator at the points in your code where you want the progress to be updated. "
This is where I need help, can somebody point in the right direction and show what and where do I need to put "Some code" in the following procedure to make the two codes work together.
Sub InfoFinal102()
Application.ScreenUpdating = False
ShowForm
'HERE GOES 0 % PROGRESS ? WHAT AND HOW?'
'N = 0'
Sheets("FACTURA").Select
Range("T184:AB184").Select
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Range("F65536").Select
Selection.End(xlUp).Select
'HERE GOES 25% PROGRESS '
'N = 25 % ?'
Sheets("EGRESOS").Select
Range("AP183:BR183").Select
Application.CutCopyMode = False
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Range("N65536").Select
Selection.End(xlUp).Select
'HERE GOES 50 % PROGRESS '
'N = 50 % ?'
Sheets("TURNOS").Select
Range("V211:AE211").Select
Application.CutCopyMode = False
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Range("G65536").Select
Selection.End(xlUp).Select
'HERE GOES 75 % PROGRESS '
'N = 75 % ?'
Sheets("IMPTOS").Select
Range("L3:Y3").Select
Application.CutCopyMode = False
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Range("B65536").Select
Selection.End(xlUp).Select
'HERE GOES 100 % PROGRESS '
'N = 100 % ?'
MsgBox "AHORA EL PROGRAMA FUNCIONARA RAPIDO - SU LIBRO DE TRABAJO NO ES TAN PESADO - BUENA LABOR HA HECHO HOY - HASTA PRONTO", vbInformation
Application.ScreenUpdating = True
ActiveWorkbook.Sheets("BOTONES").Activate
End Sub
Thank you
Cesar