- ©«¤l
- 522
- ¥DÃD
- 36
- ºëµØ
- 1
- ¿n¤À
- 603
- ÂI¦W
- 0
- §@·~¨t²Î
- win xp sp3
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-12-13
- ³Ì«áµn¿ý
- 2021-7-11
|
¥»©«³Ì«á¥Ñ yen956 ©ó 2017-2-23 09:46 ½s¿è
¦^´_ 12# peter95
¬Oªº, ¨C2¤ÀÄÁÀˬd¤@¦¸©M©µ«á2¤ÀÄÁ°O¿ýªº½T¤£¤@¼Ë,
¦³¥i¯à¨CÓÀˬdÂI³£¬O§CÂI,¦Ó¿ù¹L°ªÂI
´À¥N¤è®×:
·s¼W¼È¦sªí sheet4, ±N Worksheet_Calculate ªºµ²ªG¥þ³¡¼È©ñ¼È¦sªí sheet4,
¦A¨C2¤ÀÄÁ±q¼È¦sªí sheet4 ¤¤¿ï¨ú [C13] ³Ì°ªÈ¨º¦C
½Æ»s¨ì Sheet3, ¦p¦ó?
'©ñModule
'ɥΠHsiehª©¤jªº onTime, ½Ð©ñ¦b Module
'http://forum.twbts.com/thread-19283-1-2.html
'±q¦¤W8ÂI¨ì¤U¤È5ÂI¨C2¤ÀÄÁ°õ¦æ "Copy_test" 1¦¸
Sub OnTime_test()
Dim t
For t = TimeValue("08:00:00") To TimeValue("17:00:00") Step TimeValue("00:02:00")
Application.OnTime t, "Copy_test"
Next
End Sub
Sub Copy_TEST()
Dim LstR3 As Integer, LstR4 As Integer, sh3 As Object, sh4 As Object
Set sh3 = Sheets("Sheet3")
Set sh4 = Sheets("Sheet4")
LstR3 = sh3.[A65536].End(xlUp).Row + 1 '¨ú±o "Sheet3" ÄæA³Ì¤U±«DªÅ¥Õ®æªº¤U¤@®æ ªº¦C¸¹
LstR4 = sh4.[A65536].End(xlUp).Row '¨ú±o "Sheet4" ÄæF³Ì¤U±«DªÅ¥Õ®æªº¦C¸¹
If sh4.[A1] = "" Then Exit Sub
'«ö sh4.[F1] °¾±Æ§Ç
sh4.[A1].Resize(LstR4, 6).Select
Selection.Sort _
Key1:=sh4.[F1], Order1:=xlDescending, _
Header:=xlNo
sh4.[A1].Resize(1, 4).Copy sh3.Cells(LstR3, 1)
'²M°£sheet4, «·s¨Ñ Worksheet_Calculate ¼È¦s
sh4.Cells() = ""
End Sub
'¤U±¦P¼Ë©ñ Sheet2
Private Sub Worksheet_Calculate()
Dim Rng As Range, LstR As Integer, sh4 As Object
Set sh4 = Sheets("Sheet4")
If Not Application.IsNumber([C13]) Then Exit Sub '¨S¸ê®Æ´N¸õ¥X
LstR4 = sh4.[A65536].End(xlUp).Row '¨ú±o "Sheet4" ÄæA³Ì¤U±«DªÅ¥Õ®æªº¦C¸¹
If [C13] > 50 Then
[A17].Resize(1, 4).Copy
sh4.Cells(LstR4, 1).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
[C13].Copy '[C13]ªºÈ¤]«O¯d¨ìSheet4ÄæF
sh4.Cells(LstR4, 6).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End If
End Sub |
|