ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ·í¬Y­ÓÀx¦s®æ¼Æ­È>50,«h¥ß§Y°O¿ý«ü©wÄæ¦ìªº­È(¨DVBA)

¦³­«·s­pºâ´N·|IJ°Ê Worksheet_Calculate, µLªk©µ«á2¤ÀÄÁ,
¬G§ï¥Î¨C2¤ÀÄÁÀˬd¤@¦¸(¤£¬O°O¿ý¤@¦¸), ¨Æ¹ê¤W¦³®t¶Ü?
§Aªº·N«ä¬O µo²{ [C13] > 50 ´N©µ«á2¤ÀÄÁ°O¿ý,
³o¸ò¨C2¤ÀÄÁÀˬd¤@¦¸(¤£¬O°O¿ý¤@¦¸), µo²{ [C13] > 50 ¦A°O¿ý,
¦³®t¶Ü?

TOP

¥»©«³Ì«á¥Ñ peter95 ©ó 2017-2-22 22:39 ½s¿è

¦^´_ 11# yen956

ÁÂÁ yen956¤j¤j ¼ö±¡ªºÀ°¦£
¯uªº«Ü·PÁ§A


¤pªºªº·N«ä ¬O
·í§Ú¶}±Ò §ÚªºEXCELÀÉ®É
§AªºVBA ´N¶}©lÀˬd  [C13]
¦ý­è¶}±ÒEXCELÀÉ®É
¸ê®Æ¶q¬O§¹¥þ¨S¦³¶i¨Óªº

©Ò¥H [C13] ¨º­ÓÀx¦s®æ·|Åã¥Ü #N/A  ´N¬O¨S¸ê®Æ
«hVBA ´N·| Åã¥Ü¿ù»~

¤£¾å±o ¦³µL¿ìªk ±N¦¹±¡§Î §JªA
~~~~~~~~~~~~~~~~~~~~~~~~~


¾Ç²ß ¾Ç²ß ¤@ª½¾Ç²ß

TOP

¥»©«³Ì«á¥Ñ 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

TOP

¨C2¤ÀÄÁ«h¥i­É¥Î Hsiehª©¤jªº onTime, ¦p¤U:

Worksheet_Calculate §R°£, §ï¥Î 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 LastR As Integer, sh2 As Object, sh3 As Object
    Set sh2 = Sheets("Sheet2")
    Set sh3 = Sheets("Sheet3")
    LastR = sh3.[A65536].End(xlUp).Row + 1       '¨ú±o "Sheet3" ÄæA³Ì¤U­±«DªÅ¥Õ®æªº¤U¤@®æ ªº¦C¸¹
    If sh2.[C13] > 50 Then
        sh2.[A17].Resize(1, 4).Copy
        sh3.Cells(LastR, 1).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                :=False, Transpose:=False
    End If
End Sub
yen956 µoªí©ó 2017-2-22 20:06

½Ð°Ý¤j¤j ¬O©ñ¦b¼Ò²Õ¶Ü??

¤p§Ì¦³©ñ¦ý¬O ¨S¦³°õ¦æCOPY
½Ð°Ý§Ú¥i¥H­×¥¿­þ¸Ì
·PÁÂ
¾Ç²ß ¾Ç²ß ¤@ª½¾Ç²ß

TOP

½Ð°Ý¦U¦ì¤j¤j¡A³o­Ó¥Î©óRTDµ{¦¡¤¤¡A¦n¹³¥u·|ÀHµ{¦¡¸ê®Æªº¸õ°Ê¡A¤]¨S§PÂ_´Nª½±µCOPY¸ê®Æ¶i¥h¡A½Ð°Ý¦U¦ì¤j¤jª¾¹D¤°»ò­ì¦]¡HÁÂÁÂ
¤j®a¦n

TOP

        ÀR«ä¦Û¦b : ªY½à§O¤H´N¬O²øÄY¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD