by chijanzen on 七月 20th, 2008 | View: 1,536 views
Sub UpdateProgress(Pct) With UserForm1 .FrameProgress.Caption = Format((Pct / 100), "0%") .LabelProgress.Width = (Pct / 100) * (.FrameProgress.Width - 10) .Repaint End With End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Declare Function GetSysColor Lib "user32" ( _ ByVal nIndex As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _ ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _ ByVal hwnd As Long, _ ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function DrawMenuBar Lib "user32" ( _ ByVal hwnd As Long) As Long Private Sub UserForm_activate() Dim nam As String, dat As Date, rng As Range Dim iR As Integer, p As Double, n As Integer Me.Label1.Caption = "正在保存數據,請稍後...." Application.ScreenUpdating = False Set rng = Range("C2:C200") If [G2] <> "" And [H2] <> "" And Application.WorksheetFunction. _ CountA(rng) > 0 Then nam = [G2] dat = [H2] With Sheet5 Set lstcel = .[c65536].End(xlUp).Offset(1, 0) iR = lstcel.Row Call UpdateProgress(10) '第一階段 10% rng.Copy lstcel rng.Offset(0, -1).Copy lstcel.Offset(0, 1).PasteSpecial Paste:=xlValues, _ Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Call UpdateProgress(20) '第二階段 10% rng.Offset(0, -2).Copy lstcel.Offset(0, -1).PasteSpecial Paste:=xlValues, _ Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Call UpdateProgress(30) '第三階段 10%
Application.CutCopyMode = False p = 40 / (.[c65536].End(xlUp).Row - iR + 1) '第四階段 40%
For i = .[c65536].End(xlUp).Row To iR Step -1 n = n + 1 Call UpdateProgress(30 + (p * n)) If .Cells(i, 3) = "" Then .Rows(i).Delete Next n = 0 p = 30 / (.[c65536].End(xlUp).Row - iR + 1) '第五階段 30% For i = iR To .[c65536].End(xlUp).Row n = n + 1 Call UpdateProgress(70 + (p * n)) .Cells(i, 1) = i - 9 .Cells(i, 8) = dat .Cells(i, 9) = nam Next End With End If Sleep 1000 '1秒 Unload Me Application.ScreenUpdating = True End Sub
Popularity: 16%
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?