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

[µo°Ý] ©_©Çªº¥¨¶°??

½Ð°Ý¦¹»yªk¦p¦ó¼g?

°²¦p BOOK1.xls ¤£¬O§@¥Îµøµ¡ «h....................
IF Windows("BOOK1.xls")<>Activate THEN
¨S¦³¦¹»yªk??

TOP

¦^´_ 1# t8899
  1. If ActiveWindow.Caption <> "BOOK1.xls" Then MsgBox ActiveWindow.Caption
  2. ©Î¬O
  3. If ActiveWorkbook.Name <> "BOOK1.xls" Then MsgBox ActiveWorkbook.Name
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

½Ð°Ý¦¹¥¨¶°¿ù»~¦p¦ó­×§ï??

¥»©«³Ì«á¥Ñ t8899 ©ó 2013-11-1 15:17 ½s¿è

«¬ºA¤£²Å¦X  ªþÀÉ Book3.rar (7.9 KB)

¦b¶}¥t¤@Àɮ׫á°õ¦æ·|¿ù»~ ¡A¤£¶}«h¤£·|???
Public Runtime
Sub a123()
If Range("i1").Value <> 1 Then
On Error Resume Next
Application.OnTime EarliestTime:=TimeValue(Runtime), _
    Procedure:="a123", Schedule:=False
  Exit Sub
On Error GoTo 0
End If
Macro1
If Range("k14") = 4 Then mytime = "00:00:15"
Runtime = Now + TimeValue(mytime)
Application.OnTime Runtime, "Sheet1.a123"
End Sub

TOP

¦^´_ 2# GBKEE

½Ð°Ý¶Wª© .caption ©M .name ¦³¦ó°Ï§O?
ÁÂ
ss

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-11-1 16:55 ½s¿è

¦^´_ 4# sunnyso

½Ð¸Ô¬ÝVBAªº»¡©ú

·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-11-1 16:55 ½s¿è

¦^´_ 3# t8899
  1. Sub Macro1()
  2. If ActiveWindow.Caption <> "Book2.xls" Then
  3. Dim ah As Workbook
  4. Set ah = ActiveWorkbook         '³o¸Ì¬O Workbookª«¥ó
  5. 'Dim ah As Window                'Åܼƪ«¥ó­n¤@­P
  6. '******************³o¸Ì¿ù»~¶Ü????   **************
  7. Set ah = ActiveWindow           '³o¸Ì¬O Windowª«¥ó
  8. '*********************************************
  9. End If
  10. MsgBox "test"
  11. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

[µo°Ý] ©_©Çªº¥¨¶°??

¥»©«³Ì«á¥Ñ t8899 ©ó 2013-11-1 20:10 ½s¿è

1.15¬í¦Û°Ê°õ¦æ¤@¦¸,¨S°ÝÃD
¦ý·í¥´¶}AÀÉ®×,µøµ¡°±¯d¦bAÀÉ®×,«h©Ò±oªº¼Æ¦r¬O¤£¹ïªº???
2.³æ¥ÎSheets("Sheet1").Select ©Î  With Sheets("Sheet1")
°õ¦æ·|¼g¶iAÀɮתº¤u§@ªí¸Ì???
Sub Macro1()
Dim ah As Workbook
Set ah = ActiveWorkbook
'   Sheets("Sheet1").Select
'   With Sheets("Sheet1")
Workbooks("book2.xls").Sheets("Sheet1").Range("a1").Value = Now
t = [TEXT(A1,"hh:mm")+LOOKUP(--TEXT(A1,"s"),{0,15,30,45})/86400]
Workbooks("book2.xls").Sheets("Sheet1").Range("a65536").End(xlUp).Offset(1).Value = Format(t, "hh:mm:ss")
' End With
ah.Activate
End Sub
Book2.rar (9.06 KB)

¦^´_ 7# t8899
  1. Sub Macro1()
  2.     Dim t, Ar()
  3.     Ar = Array(60, 45, 30, 15)
  4.     With Workbooks("book2.xls").Sheets("Sheet1")
  5.         .Range("a1").Value = Now
  6.         t = Val(Format(.Range("a1"), "s"))
  7.         t = Application.Match(t, Ar, -1)
  8.         t = Application.Text(.[A1], "hh:mm:") & Ar(t - 1)
  9.         '*************************************************************
  10.         't = [TEXT(A1,"hh:mm")+LOOKUP(--TEXT(A1,"s"),{0,15,30,45})/86400]
  11.         ' ³o¸ÌªºA1¬O§@¥Î¤¤¬¡­¶Ã¯ActiveWorkbook(·í¥´¶}AÀÉ®×)ªºActiveSheetªº A1
  12.        '************************************************************
  13.         .Range("a65536").End(xlUp).Offset(1).Value = Format(t, "hh:mm:ss")
  14.     End With
  15. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ t8899 ©ó 2013-11-1 22:13 ½s¿è

¦^´_ 8# GBKEE

     
    't = [TEXT(A1,"hh:mm")+LOOKUP(--TEXT(A1,"s"),{0,15,30,45})/86400]
        ' ³o¸ÌªºA1¬O§@¥Î¤¤¬¡­¶Ã¯ActiveWorkbook(·í¥´¶}AÀÉ®×)ªºActiveSheetªº A1     

³æ¯Â¯à§_¥u§ï³o¥y¨Ó¸Ñ¨M©O??
³o¥y¸ÌªºA1 µLªk«ü©w¨ì  Workbooks("book2.xls").Sheets("Sheet1")  ¸Ì??
t = [TEXT(NOW,"hh:mm")+LOOKUP(--TEXT(NOW,"s"),{0,15,30,45})/86400]

TOP

¦^´_ 9# t8899
VBA¨ç¼Æ   NOW
¤u§@ªí¨ç¼Æ NOW()
  1. t = [TEXT(NOW(),"hh:mm")+LOOKUP(--TEXT(NOW(),"s"),{0,15,30,45})/86400]
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¡i¬O§_µo´§¤F¨}¯à¡H¡j¤H¶¡¹Ø©R¦]¬°µu¼È¡A¤~§óÅã±o¬Ã¶Q¡CÃø±o¨Ó¤@½ë¤H¶¡¡AÀ³°Ý¬O§_¬°¤H¶¡µo´§¤F¦Û¤vªº¨}¯à¡A¦Ó¤£­n¤@¨ý¨Dªø¹Ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD