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

[µo°Ý] EXCEL VBA»yªkºÃ°Ý

[µo°Ý] EXCEL VBA»yªkºÃ°Ý

½Ð°Ý¦U¦ì°ª¤â,¯à§_À°¦£Àˬd³o­ÓVBA»yªk­þ¸Ì¦³¿ù,¬°¦ó´N¬OµLªk¶}©l¦Û°Ê°O¿ý©O???ÁÂÁ¤j¤j




Public uMode&, StartTime, EndTime
  Public MyBook As Workbook, Sht1 As Worksheet, Sht2 As Worksheet, xRow&
  
  Sub ¤u§@ªí4¦@¥Î°Ñ·Ó()
  
  Set MyBook = ThisWorkbook
  Set Sht1 = MyBook.Sheets("¤u§@ªí4")  '«ü©w¬¡­¶¦WºÙ¡]¤u§@ªí4¡^
  
  StartTime = "08:44:01" '¶}½L®É¶¡¡]´£¦­60¬í±Ò°Ê°O¿ý¡^
  EndTime = "23:45:05"   '¦¬½L®É¶¡¡]©µ«á5 ¬í°±¤î°O¿ý¡^
   
  End Sub
  Sub ¤u§@ªí4¦Û°Ê°O¿ý()
  If uMode = 0 Then Exit Sub
  
  If Time > TimeValue(EndTime) Then
  Sht1.[Q2] = "¤w¹L¦¬½L"   'ª¬ºAÅã¥Ü¡]°O¿ý¦bQ2¡^
  uMode = 0
  Exit Sub
  End If
  
  Sht1.Range("C2") = Time '¨é°Ó®É¶¡¡]°O¿ý¦bC2¡^  ²Ä2¦C¬°DDE³sµ²
  '----------------------------------------------------------
  If Second(Time) = 0 And Minute(Time) Mod 1 = 0 Then
  
  xRow = Sht1.Range("B65536").End(xlUp).Row + 1

  If xRow < 4 Then xRow = 4  '±q²Ä4¦C¶}©l ³v¦¸¥[1¦C¬ö¿ý
  
  Sht1.Range("C" & xRow & ":E" & xRow).Value = Sht1.Range("C2:E2").Value  'C~E ¬O§ÚDDEªº¦ì¸m¡]°O¿ý²Ä2¦C¡^
'------------------------------------------------
  ThisWorkbook.Save
  Beep
  End If
  Application.OnTime Now + TimeValue("00:00:01"), "¤u§@ªí4¦Û°Ê°O¿ý" '¨C¤@¬í»¼°j¤@¦¸
  End Sub
  Sub ¤u§@ªí4¶}©l°õ¦æ()
  If uMode = 1 Then Exit Sub
  Call ¤u§@ªí4¦@¥Î°Ñ·Ó
  uMode = 1
  Sht1.[Q2] = "°õ¦æ¤¤"   'ª¬ºAÅã¥Ü¡]°O¿ý¦bQ2¡^
  Call ¤u§@ªí4¦Û°Ê°O¿ý
  End Sub
  Sub ¤u§@ªí4°±¤î°õ¦æ()
  uMode = 0
  Call ¤u§@ªí4¦@¥Î°Ñ·Ó
  Sht1.[Q2] = "STOP"    'ª¬ºAÅã¥Ü¡]°O¿ý¦bQ2¡^
  End Sub
  Sub ¤u§@ªí4²M°£°O¿ý()     '§Ú¤w¸g§ï¦Û°Ê°õ¦æ ©Ò¥H³o­Óĵ¥Ü®Ø¨ú®ø¤F
  'Beep
  'If MsgBox("¡°½T©w­n²M°£¡e¤u§@ªí4¡fªº¼Æ¾Ú¶Ü¡H ", 4 + 32 + 256) = vbNo Then Exit Sub
  Call ¤u§@ªí4¦@¥Î°Ñ·Ó
  Sht1.Rows("4:65536").ClearContents   '¶}½L«e²M°£4¦C(§t)¥H¤U¥þ³¡¸ê®Æ
  If ActiveSheet.Name = Sht1.Name Then ActiveWindow.ScrollRow = 1
  Beep
  End Sub

¤j¤j±z¦n¡A½Ð°Ý±z¦³§ä¨ìµª®×¤F¶Ü? §Ú¤]¹J¨ì¬Û¦Pªº°ÝÃD

¦^´_ 1# southwind1009

TOP

Àɮ׶ǤW¨Ó¬Ý¬Ý

TOP

§Ú¬Ý¨ìªº³q³q¬O¨ç¼Æ¡A³o­ÓVBA¬O¦b¨º­Ó¨Æ¥ó¤U±Ò°Ê........¨S¬Ý¨ì±Ò°Êªº¨Æ¥ó
Live and learn

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD