¤@¬qÃö©ó¶}½L»ù³Ì°ª»ù³Ì§C»ù¦¬½L»ùªºvbµ{¦¡½X½Ð±Ð
- ©«¤l
- 81
- ¥DÃD
- 31
- ºëµØ
- 0
- ¿n¤À
- 117
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- office2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2013-8-3
- ³Ì«áµn¿ý
- 2024-4-30
|
¤@¬qÃö©ó¶}½L»ù³Ì°ª»ù³Ì§C»ù¦¬½L»ùªºvbµ{¦¡½X½Ð±Ð
Private Sub Worksheet_Calculate()
Dim NowDateTime, nowTime, startTime, stopTime
Dim tr As String
NowDateTime = Now '²{¦bªº®É¶¡È, ¥h±¼¾ã¼Æ³¡¥÷,
nowTime = (NowDateTime - Int(NowDateTime)) '±o¨ì²{¦bªº®É¶¡È
startTime = Range("A6") '¶}½L®É¶¡, ¨Ò¦p: "09:00:00 AM"
stopTime = Range("A8") '¦¬½L®É¶¡, ¨Ò¦p: "01:30:00 PM"
If nowTime <= startTime Then '©|¥¼¶}½L
Exit Sub
ElseIf nowTime > stopTime Then '¤w¸g¦¬½L
Exit Sub
ElseIf [A2] <> "-" And [A2] <> "###" Then '²M½Lªºª¬ºA, ¤£¨ú¨ä¸ê®Æ
tr = Int((nowTime - startTime) * 288) + 2 '¨C®t 300 ¬í´N´«¤@¦C
If Range("D" & tr) = "" Then
Range("D" & tr) = Range("A2") '¶}©l»ù
End If
If Range("E" & tr) = "" Or Range("A2") > Range("E" & tr) Then
Range("E" & tr) = Range("A2") '³Ì°ª»ù
End If
If Range("F" & tr) = "" Or Range("A2") < Range("F" & tr) Then
Range("F" & tr) = Range("A2") '³Ì§C»ù
End If
Range("G" & tr) = Range("A2") 'µ²§ô»ù
End If
End Sub
°ÝÃD:
1.Private Sub Worksheet_Calculate()
Dim NowDateTime, nowTime, startTime, stopTime
Dim tr As String
³o¤@°Ïªº·N¸q¬O?
²Ä¤@±Æªºdim¨S¦³¼g¥X¸ê®Æ«¬ºA¬O¤°»ò
²Ä¤G±Æ¬O©w¸qtrªº¸ê®Æ«¬ºA¬°¦r¦ê
³o¤@°Ï¬O«Å§i¦b³o¾ã±i¤u§@ªí³£¾A¥Îªº·N«ä¶Ü
2. ElseIf [A2] <> "-" And [A2] <> "###" Then '²M½Lªºª¬ºA, ¤£¨ú¨ä¸ê®Æ
³o¤@¬q¸Ìªº"###"¬O¤°»ò·N«ä©O?~~«e±ªº·N«ä¬O¼ga2¤£µ¥©óªÅ¥Õ~~and a2¤£µ¥©ó###~~¨º½Ð°Ý###¬O¤°»ò·N«äªü??
3.tr = Int((nowTime - startTime) * 288) + 2 '¨C®t 300 ¬í´N´«¤@¦C
start=¦¤W9ÂI~~nowtime=²{¦bªº®É¶¡~~*288+2~~³o¤@¦ê§Ú¤£¤j¯à²z¸Ñ~~Áٽаª¤â¯à¨ó§U¸ÑÄÀ¤@¤U¶Ü?·PÁ¤F
°ÝÃD«Ü°ò¦~~Ó¤H¦Û¾Ç´XÓ¤ë~~«Ü¦h¤@ª¾¥b¸Ñ~~°ÝÃDY¤Ó²Â~~ÁٽШ£½Ì |
|
|
|
|
|
|
- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 14
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-11-6
|
¥»©«³Ì«á¥Ñ luhpro ©ó 2015-5-5 23:26 ½s¿è
Private Sub Worksheet_Calculate()
Dim NowDateTime, nowTime, startTime, stopTime
Di ...
laieven µoªí©ó 2015-5-5 16:32
²Ä¤@±Æªºdim¨S¦³¼g¥X¸ê®Æ«¬ºA¬O¤°»ò
¨S¦³¼g¥X¸ê®Æ«¬ºAªº ´N¬O Variant, ¾A¥Î½d³ò³Ì¼s, ¦ý³Ì¯Ó°O¾ÐÅéªÅ¶¡.
³o¤@°Ï¬O«Å§i¦b³o¾ã±i¤u§@ªí³£¾A¥Îªº·N«ä¶Ü
¦b Sub °Ï¶ô¤ºªºÅܼƩw¸q¥u¯à¾A¥Î©ó¸Ó Sub °Ï¶ô,
¥þ°ìÅܼƤ@¯ë³£¬O©w¸q¦b Module °Ï¶ô¤º¥B¥H Public «O¯d¦r§@¶}ÀY.
³o¤@¬q¸Ìªº"###"¬O¤°»ò·N«ä©O?~~
³oÀ³¸Ó¬O¬Ý½L³nÅéÅã¥Ü¥X¨Ó±a¦³¯S©w·N¸qªºªí¥Ü¤è¦¡,
n¬Ý§Aµ{¦¡¬O±qþ¨Óªº?¦³¨S¦³»¡¬Oþ®M¬Ý½L³nÅé?
tr = Int((nowTime - startTime) * 288) + 2 '¨C®t 300 ¬í´N´«¤@¦C
start=¦¤W9ÂI~~nowtime=²{¦bªº®É¶¡~~*288+2~~³o¤@¦ê§Ú¤£¤j¯à²z¸Ñ~~
Y¥H¤@ӼƦr¨Óªí¥Ü®É¶¡È,¾ã¼Æ³¡¤Àªí¥Ü¤é´Á,¤p¼Æ³¡¤À«hªí¥Ü®É¶¡
(24*60*60)/300=288
®É ¤À ¬í
¤@ ¤Ñ |
|
|
|
|
|
|
- ©«¤l
- 81
- ¥DÃD
- 31
- ºëµØ
- 0
- ¿n¤À
- 117
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- office2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2013-8-3
- ³Ì«áµn¿ý
- 2024-4-30
|
¦^´_ 2# luhpro
¥ý·PÁÂ"luhpro"ªº¼ö¤ß¨ó§U!!!·P®¦!!
1.288ªº¬O¨C5¤ÀÄÁªº·N«ä³o§Ú¯à²z¸Ñ~~§Ú¥u¬O¹ï³o¦ê"tr = Int((nowTime - startTime) * 288) +2"
¤£¤jÀ´(³o°ÝÃD¦ü¥G¦³ÂIÄø¡ã¤£¦n·N«ä)
int¬OÓ¨ú¾ã¼Æªº¨ç¼Æ
¬°¦ó¥Î²{¦bªº®É¶¡¥h´î±¼¶}©lªº®É¶¡~~³o¤£´N±o¨ì¤F±q¶}©l¨ì²{¦bÁ`¦@¤w¸g¨«¤F¦h¤Ö®É¶¡¹ï¶Ü!
¨º¬°¦ó*288~~~°²³]9ÂI¶}©l~~²{¦b¬O9ÂI5¤À~~¾ãÓ¦¡¤l¤£´NÅܦ¨int(5*288)+2~~~¤£¤j¯à²z¸Ñ®º????ÁÙ¦³¨ºÓ+2¬On·F¹À¥Î©O?
2.³]¦ntr¤§«á~~´N§â¥¦©ñ¨ì«á±
" If Range("D" & tr) = "" Then
Range("D" & tr) = Range("A2")
µ¥µ¥µ¥ªº¦¡¤l¸Ì~~~¦ü¥G¬O¥Îpºâ«áªºµ²ªG¨Ó°µ¬°Àx¦s®æªº¦ì¸mpºâ¥Î~~Åý¾Þ§@ªºÀx¦s®æ
¥i¯à¬Od5©Îd8©Îd2¤£µ¥ªº¦ì¸m~~°²³]pºâµ²ªG¬O5³o¤@¬q¬O§Æ±æ³o¤@¬q®É¶¡¤º¾ãÓpºâ¬yµ{¥u¦bd5-e5-f5-g5³o¤@¦C°µ¤j¤pµ§°O¨Ã±Æ§Ç~~¹ï¶Ü? |
|
|
|
|
|
|
- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 14
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-11-6
|
¦^´_ 3# laieven
¤£¬Oªº³á.
¤W±»¡¹L :
Y¥H¤@ӼƦr¨Óªí¥Ü®É¶¡È,¾ã¼Æ³¡¤Àªí¥Ü¤é´Á,¤p¼Æ³¡¤À«hªí¥Ü®É¶¡
¦b즡 tr = Int((nowTime - startTime) * 288) + 2 '¨C®t 300 ¬í´N´«¤@¦C ¤¤,
tr ·|¨C 300 ¬í´N¥[ 1(¤]´N¬O ¨C®t 300 ¬í´N´«¤@¦C ªº·N«ä),
Äpµ²´N¦b©ó "¤p¼Æ³¡¤À«hªí¥Ü®É¶¡" ³o¤@ÂI,
·í®É¶¡®tªº¤p¼Æ³¡¤À¼¤W 288 ±µµÛ¦A¨ú¾ã¼Æ¤§«á´N·|¥X²{³o¼Ëªºµ²ªG.
§A¥i¥H°õ¦æ¥H¤Uµ{¦¡¬Ý¬Ýµ²ªG:- Sub nn()
- Dim tr&
- Dim startTime As Date
-
- startTime = Now
- Do While tr <= 20
- tr = Int((Now - startTime) * 28800) + 2 '¨C®t 3 ¬í´N´«¤@¦C
- Cells(tr, 1) = tr
- Loop
- End Sub
½Æ»s¥N½X ·í§Ú̹ï©óµ{¦¡¬Y¨Ç³¡¤À¦³ºÃ¼{ªº®ÉÔ,
³Ì²³æªº¤è¦¡´N¬O¥Î F8 (³æ¨B¼Ò¦¡) Try Try ¬Ý,
§Ú³Ì±`¥Îªº¤è¦¡¬O¥ý¦b "§Y®É¹Bºâ" µøµ¡¤¤¥Î ? ¨Ó½T»{¤U¤@¦C¬ÛÃöÅܼƷ|Åܦ¨¬Æ»òÈ,
©Î¬O¤U¤@¦C·Qn°µ¬Æ»ò¨Æ, (¨Ò¦pY¬O Cells ©Î Range «h½T»{n§@¥ÎªºÀx¦s®æ¬Oþ¤@Ó<¨Ç>)
¦A«ö¤@¦¸ F8 ½T»{µ²ªG¬O§_»P§Ú©Ò¹w´Áªº¬Û¦P. |
|
|
|
|
|
|
- ©«¤l
- 81
- ¥DÃD
- 31
- ºëµØ
- 0
- ¿n¤À
- 117
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- office2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2013-8-3
- ³Ì«áµn¿ý
- 2024-4-30
|
¦^´_ 4# luhpro
·PÁ¼ö¤ß¦^µª
§Ú·|¦h¹Á¸Õ¬Ý¬Ý
·PÁ§A |
|
|
|
|
|
|
- ©«¤l
- 81
- ¥DÃD
- 31
- ºëµØ
- 0
- ¿n¤À
- 117
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- office2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2013-8-3
- ³Ì«áµn¿ý
- 2024-4-30
|
¦^´_ 4# luhpro
°ÝÃD½Ð±Ð
.Private Sub Worksheet_Calculate()
¼g¦b³oÓpºâµ{§Çªº·N«ä£¿~~¬O¤£¬O´N¬O¥Nªí¥un¸ÓÀÉ®×±Ò°Ê~~³oÓ¤u§@ªí´N¦Û°Ê±Ò°Êpºâ
¦Ó³oÓµ{§Ç¤]¸Ó¼g¦b¤u§@ªí¤¤¦Ó¤£¬O"thisbook"ùؤ]¤£¬O¼g¦b¼Ò²Õ¶Ü~~¹ï¶Ü? |
|
|
|
|
|
|