by chijanzen on 七月 20th, 2008 | View: 1,870 views
Public j As Double
With UserForm1
.LabPct1.Caption = Pct * 100 & " %": DoEvents '顯示百分比
.LabProg21.Width = Pct * (.LabProgressBar2.Width - j)
intPctColor = CInt((Pct * 255) * 0.75) '紅色色系
lngColor = RGB(64 + intPctColor, 0, 0)
.LabProg21.BackColor = lngColor: DoEvents '顯示進度條背景色
DoEvents
.Repaint
End With
End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim strText1 As String
Dim intI, i As Integer
Private Sub UserForm_activate()
Me.Label1 = "程式執行中"
Me.LabProg21.Width = 0 '清除Type 2進度條方塊
Me.LabPct1.Visible = True
j = (Me.LabProg21.Left - Me.LabProgressBar2.Left) * 2
With Application
.EnableEvents = False
.ScreenUpdating = False '關閉復螢幕更新
strText1 = Sheets("LL").ComboBox1.Text
For i = 5 To 26
rng(i).Copy Destination:=Sheets("LL").Cells(i, 2)
K = K + 1
DcPct = K / ((26 - 5) + 1) '進度百分比
Call UpdateProgress(DcPct) '更新進度條百分比
Next i
Worksheets("SJ").Cells.AutoFilter '關閉篩選
.EnableEvents = True
.ScreenUpdating = True '開啟螢幕更新
Sleep 1000 '1秒
Unload Me
Function rng(i) As Range
With Worksheets("SJ")
ctxt = Worksheets("LL").Cells(i, 1)
'篩選公司
.Cells.AutoFilter Field:=2, Criteria1:=ctxt
'篩選月份
.Cells.AutoFilter Field:=1, Criteria1:=strText1
'指定範圍
Set rng = .Range("C2:W" & .[A65536].End(xlUp).Row). _
SpecialCells(xlCellTypeVisible)
End Function
DcPct = (K / ((26 - 5) + 1)) * 100
xlCellTypeVisible:所有可見儲存格
本範例進度條所使用的色係為紅色色系lngColor = RGB(64 + intPctColor, 0, 0),也可以改成藍色色系或其他色系
例如改成藍色色系 lngColor = RGB(0, 0, 64 + intPctColor)
例如改成綠色色系 lgColor = RGB(0, 64 + intPctColor, 0)
Popularity: 18%
Why don't you make one?
Name: « Required
Email Address: « Required
Website URL: « Optional
Type your message here...
You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
發表於討論區 一般訪客留言 於 九月 7, 2010
發表於討論區 一般訪客留言 於 六月 6, 2010
發表於討論區 API函數 於 一月 19, 2010
發表於討論區 技術交流 於 一月 13, 2010
發表於討論區 一般訪客留言 by reader 於 九月 7, 2010 at 9:31 下午
發表於討論區 一般訪客留言 by kenjo 於 六月 6, 2010 at 2:55 下午
發表於討論區 API函數 by chijanzen 於 一月 19, 2010 at 1:50 下午
發表於討論區 API函數 by chijanzen 於 一月 19, 2010 at 1:11 下午
發表於討論區 技術交流 by chijanzen 於 一月 13, 2010 at 5:43 下午
GEOLOC
姓名:超級皮卡丘
網路化名: chijanzen、中國龍
經歷:
Why don't you make one?