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

[µo°Ý] ¦¹¥¨¶°¬°¦ó¿ù??

¦^´_  t8899
¦]¬°º¦¶^¨âÃä³£­n°õ¦æ,
©Ò¥H·|¥[¨â¦æ :¥t¥~,«Øij§A¥i¥H°Ñ¦ÒÃþ¦ü¤W­±³o¼Ë¦³°µÁY±Æ³B²zªºµ{¦¡ ...
luhpro µoªí©ó 2013-8-15 21:47

©êºp ¤W¤@¼ÓÀɮצ³»~¡A½Ð¥Î³o­ÓÀÉ®×´ú¸Õ
TEST.rar (22.42 KB)

TOP

ZZ.Offset(, 26) ====>¥i§_ª½±µ§ï¦¨ACÄ檺»yªk??

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2013-8-17 09:14 ½s¿è
ZZ.Offset(, 26) ====>¥i§_ª½±µ§ï¦¨ACÄ檺»yªk??
t8899 µoªí©ó 2013-8-16 18:47
°T®§µLªk¤@¦¸¥X²{???·|¤@°¦¤@°¦¥X²{??
t8899 µoªí©ó 2013-8-15 22:07

¨º¬O¦]¬°¶] ZZ.Offset(, 26) = ZZ ³o¤@¦æ«ü¥O®É¤S·|IJµo Calculate ¨Æ¥ó,
¾É­P¤S¦A¤@¦¸¶i¤J¤F  Worksheet_Calculate ¨ç¦¡.
¥u­n¦b°õ¦æ¦¹¦æ«ü¥O®É§âIJµo¥\¯à¼È®É¸T¯à§Y¥i :
±N¨â­Ó
  ZZ.Offset(, 26) = ZZ
³£§ï¦¨
Application.EnableEvents = False
  ZZ.Offset(, 26) = ZZ
Application.EnableEvents = True
§Y¥i

ZZ.Offset(, 26) ====>¥i§_ª½±µ§ï¦¨ACÄ檺»yªk??
t8899 µoªí©ó 2013-8-16 18:47

Range.Offset «ü¥O¬O¶Ç¦^ :
¥H¸ÓRange¬°°ò·Ç,
¦ì²¾Offset¥k¤è¬A©·¤º©Ò«ü©wªº¦C¼Æ»PÄæ¼Æ«áªºÀx¦s®æ¦ì§}.

¦¹¨ç¦¡¶Ç¦^ªº¬O­Ó "¬Û¹ï" ¦ì¸m,
¦ÛµM´N¤£¯à¥ÎACÄ檺»yªk°Õ.

ZZ.Offset(, 26)
´Nµ¥©ó
Range(ZZ.Row, ZZ.Column + 26)

­Y°í«ù­n§ï¦¨ACÄæ»yªk«j±j¥i¥H§ï¬°
Range("AC" & CStr(ZZ.Row))
¦]¬°¦C¸¹¬O¶·­n°Ñ¦ÒZZ¦Ó°µÅܰʪº,
¦Ó­Y¤é«á§Aªº ZZ §ï¦¨¤£¦b "C" Äæ®É,
¤W¦¡¶Ç¦^ªº¦ì§}´N¤S¤£¥¿½T¤F.

TOP

¥»©«³Ì«á¥Ñ t8899 ©ó 2013-8-18 09:21 ½s¿è
­Y°í«ù­n§ï¦¨ACÄæ»yªk«j±j¥i¥H§ï¬°
Range("AC" & CStr(ZZ.Row))
¦]¬°¦C¸¹¬O¶·­n°Ñ¦ÒZZ¦Ó°µÅܰʪº,
¦Ó­Y¤é«á§Aªº ZZ §ï¦¨¤£¦b "C" Äæ®É,
¤W¦¡¶Ç¦^ªº¦ì§}´N¤S¤£¥¿½T¤F.
luhpro µoªí©ó 2013-8-17 09:11

¥¨¶°¸Ìªº¤½¦¡¡A¦n¹³¤£·|¸òµÛ¤u§@ªíÅÜ°Ê°Ñ·Ó??
¨Ò¦p If Range("Q2").Value = 1
§Ú¦bPÄæ´¡¤J¤@Äæ¡A¥¨¶°¤£·|¦Û°Ê§ï¬° If Range("R2").Value = 1 ?
¦pªG­n¸òµÛÅܰʧאּ
IF Range("Q2").Offset(, 0) = 1  ?¬O³o¼Ë¶Ü?

TOP

¥¨¶°¸Ìªº¤½¦¡¡A¦n¹³¤£·|¸òµÛ¤u§@ªíÅÜ°Ê°Ñ·Ó??
¨Ò¦p If Range("Q2").Value = 1
§Ú¦bPÄæ´¡¤J¤@Äæ¡A¥¨¶°¤£ ...
t8899 µoªí©ó 2013-8-18 09:11

¥¨¶°ùتºµ{¦¡¤ùÂ_»PÀx¦s®æ¥»¨Ó´N¤£¬O¸j¦b¤@°_¦Ó¬O¦U¦Û¿W¥ßªº,
Range("Q2") ¥Ã»·´N¬O«ü Q2 ³o­ÓÀx¦s®æ,
¦Ó¦b¨ä¥kÃ䪺 .Offset(xx,yy) ¤]¥u¯à¹ïÀ³¨ì°ß¤@¤@­ÓÀx¦s®æ,
¦Ó¤W¦C¨â­ÓÀx¦s®æ¨Ã¤£·|¦]¬°§A¦b¨ä«e¤è´¡¤JÄæ¦C¦Ó¸òµÛÅÜ°Ê.

­Y»Ý­n¬ÛÀ³ªº¸òµÛÀx¦s®æ°µÅÜ°Ê,
¤ñ¸û¥i¦æªº¤èªk§Ú¯à·Q¨ìªº¦³¨âºØ:
1. ¦b¬Y­ÓÀx¦s®æ¤º¤U¤½¦¡¥h°Ñ·Ó¨ì¼ÐªºÀx¦s®æ,¦Ó Excel VBA µ{¦¡«h³z¹L°Ñ·Ó¦ì§}°µ³B²z.(«e´£¬O¤£½×«ç»ò´¡¤JÄæ¦C,³£¤£¯àÅܰʨì°Ñ·ÓÀx¦s®æªº¦ì¸m)
¥iÂÇ¥Ñ Range(Mid(Cells(3,1).Formula,2)).Row ¨ú±o¦C¸¹
¥iÂÇ¥Ñ Range(Mid(Cells(3,1).Formula,2)).Column  ¨ú±oÄ渹.

2. ¹ï¼ÐªºÀx¦s®æ©w¸q¦WºÙ,¦Ó Excel VBA µ{¦¡«h³z¹L¸Ó¦WºÙªº¦ì§}°µ³B²z.
¨Ò¦p:
** ©w¸q¦WºÙ¬° Work °Ñ·Ó¨ì =Sheet1!$A$4
¦b With ActiveWorkbook.Names("Work")  »P End With ¤§¶¡:
¥i¥Î .Value §ì¨ì =Sheet1!$A$4 µ¥¤å¦r,
¦A¥Î Range( Mid(.Value, InStr(1, .Value, "!") + 1)).Row ¥i§ì¨ì¦C¸¹.
Range( Mid(.Value, InStr(1, .Value, "!") + 1)).Column ¥i§ì¨ìÄ渹.

TOP

¥»©«³Ì«á¥Ñ t8899 ©ó 2013-8-22 04:47 ½s¿è
¥¨¶°ùتºµ{¦¡¤ùÂ_»PÀx¦s®æ¥»¨Ó´N¤£¬O¸j¦b¤@°_¦Ó¬O¦U¦Û¿W¥ßªº,
Range("Q2") ¥Ã»·´N¬O«ü Q2 ³o­ÓÀx¦s®æ,
...
luhpro µoªí©ó 2013-8-19 22:20


1.¤§«eªº°ÝÃD¡A¸g¦A´ú¸ÕµLªk¦Û°ÊÃö±¼°T®§µ¡
¬O¦]¬°¶]¤U­±ªºµ{¦¡,¤£ª¾¦³µL¿ìªk§ïµ½?
¦n¹³¥u­n¦³¦b¶]time ªºµ{¦¡¡A´N·|³o¼Ë
Sub a123()
If [U1] <> 1 Then
On Error Resume Next
Application.OnTime EarliestTime:=TimeValue(Runtime), _
    Procedure:="a123", Schedule:=False
  Exit Sub
On Error GoTo 0
End If
zzzzz
If Range("V14") = 1 Then mytime = "00:01:00"
If Range("V14") = 2 Then mytime = "00:02:00"
If Range("V14") = 3 Then mytime = "00:00:30"
Runtime = Now + TimeValue(mytime)
Application.OnTime Runtime, "Sheet6.a123"
End Sub

2.«á¨Ó§ä¤F¤@­ÓAPI(MsgBoxTest)®M¥Î,¥N´ÀCreateObject("Wscript.shell").Popup¡A
¦³°ÝÃD??«¬ºA¤£²Å¦X???¿ù¦b¬õ¦â¦r?


Private Declare Function MsgBoxTest Lib "user32" Alias "MessageBoxTimeoutA" ( _
    ByVal hwnd As Long, _
    ByVal lpText As String, _
    ByVal lpCaption As String, _
    ByVal wType As VbMsgBoxStyle, _
    ByVal wlange As Long, _
    ByVal dwTimeout As Long) As Long
Private Sub Worksheet_Calculate()
Application.DisplayStatusBar = False
  Dim sStr$
  Dim ZZ As Range
  
  sStr = ""
  sStr2 = ""
  For Each ZZ In Range("c2:c111")
    If Not IsError(ZZ) Then
      If Range("Q26").Value = 1 And flag = True Then
        M = Round(ZZ - ZZ.Offset(, 26), 2)
        If M >= ZZ.Offset(, 2) Then
          If sStr <> "" Then sStr = sStr & Chr(10)
          sStr = sStr & "" & Cells(ZZ.Row, 2).Value & "=====> " _
                 & Round(ZZ - ZZ.Offset(, 26), 2)
        
        End If
        If M <= -ZZ.Offset(, 2) Then
          If sStr2 <> "" Then sStr2 = sStr2 & Chr(10)
          sStr2 = sStr2 & "" & Cells(ZZ.Row, 2).Value & "=====> " _
                   & Round(ZZ - ZZ.Offset(, 26), 2)
         
        End If
      End If
    End If
  Next
  If sStr <> "" Then
    MsgBoxTest 0, "", "", sStr, 0, 2500
  End If
  If sStr2 <> "" Then
   MsgBoxTest 0, "", "", sStr2, 0, 2500
  End If

3.¥t¥~¤@­Ó¤èªk¥Î" FindWindow " ¨ÓÃö³¬³o°T®§µ¡¡A¤£¹L§ä¤£¨ì³o°T®§µ¡? test.rar (9.63 KB)
http://hi.baidu.com/zzllrr/item/9a561a634853bc90c4d2493d

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2013-8-22 23:58 ½s¿è
1.¤§«eªº°ÝÃD¡A¸g¦A´ú¸ÕµLªk¦Û°ÊÃö±¼°T®§µ¡
¬O¦]¬°¶]¤U­±ªºµ{¦¡,¤£ª¾¦³µL¿ìªk§ïµ½?
¦n¹³¥u­n¦³¦b¶]ti ...
t8899 µoªí©ó 2013-8-22 04:35

1. ³o§Ú¤]¤£ª¾¹D,¤£¹L¾Ú§Ú©Òª¾ Excel VBA ²¦³º¤£¬O³æ¯Âªº VB ¨t²Î,
¦b¬Y¨Ç±¡§Î¤UÁÙ¬O·|µo¥Í¬Y¨Ç§Ú­Ìı±o¤£¤Ó¯à²z¸Ñªºª¬ªp.

³Ì²³æªº¨Ò¤l¬O­Y¬Y®É¶¡¦³¶}¤F¨â­Ó Excel ÀÉ®×,¨ä¤¤¤@­Ó¦³ Excel VBA µ{¦¡ªºÀÉ®×,
¦³¥i¯à·|¤zÂZ¨ì¥t¤@­Ó¨S¦³ VBA µ{¦¡Àɮתº½s¿è§@·~.(¤×¨ä¬O Worksheet_Change »P Worksheet_SelectionChange µ{§Ç³Ì©öµo¥Í¦¹ª¬ªp)

¨Ì§Aªº±Ô­z¬Ý°_¨Ó,
¥¦¥i¯à¤£¯à¦P®É°õ¦æ¤Ó¦hªº Application.OnTime µ{¦¡.(ºÃ¦ü·|¦³¬Û¤¬¤zÂZªº±¡§Î¥X²{)

·íµM³o­Ó´N¬O«Ü¤º³¡ªºªF¦è¤F,
·í Excel VBA ¨C©I¥s¤@¦¸ Application.OnTime µ{¦¡,
¬O§_´N·|°t¸m¤@­Óµ{§ÇªÅ¶¡¨Ó¦s©ñ¸Óµ{¦¡¹B§@¤¤ªºÅܼÆ,
ª½¨ì¸Óµ{¦¡µ²§ô¤~ÄÀ©ñ±¼¸ÓªÅ¶¡?
¥ç©Î¬O¥u­n¬O°õ¦æ¸Óµ{¦¡,
´N³£¬O¨Ï¥Î¦P¤@­Óµ{§ÇªÅ¶¡¸ÌªºÅܼƩO?
­Y¬O«áªÌ¨º¥X²{§A»¡ªº±¡§ÎÀ³¸Ó´N¤£·N¥~¤F.

¦Ó­Y¯u­n¬O³o­Ó°ÝÃD¤]¬O¦³¤èªk¸Ñ¨Mªº°Õ,
¥u­n "¨C­Ó" ©I¥sªºµ{¦¡³£¤£¦P´N¤£·|¤¬¬Û¤zÂZ¤F,
¥ç§Y­n½T«O¦P¤@®É¶¡¦b¶]ªº OnTime µ{¦¡³£¬O¦b¤£¦Pµ{¦¡°Ï¶ô¤¤§Y¥i.
¥i¤£¥i¦æ§Ú¤£ª¾¹D§A¥i¥H¸Õ¸Õ¬Ý.

2. »P¤W¤èªº©w¸q¤º®e¤@¤@¤ñ¹ï§Y¥iª¾¹D¿ù»~¥X¦b­þ¸Ì¤F:
§Aªº©I¥sµ{¦¡¬° :

MsgBoxTest 0, "", "", sStr, 0, 2500

¦Ó¨ä©w¸q«h¬° :
Private Declare Function MsgBoxTest Lib "user32" Alias "MessageBoxTimeoutA" ( _
    ByVal hwnd As Long, _                 <=== ¤W­±ªº 0 ,   OK
    ByVal lpText As String, _              <=== ¤W­±ªº "",   OK
    ByVal lpCaption As String, _          <=== ¤W­±ªº "",   OK
    ByVal wType As VbMsgBoxStyle, _ <=== ¤W­±ªº sStr, ¿ù»~¥X¦b¦¹
   ByVal wlange As Long, _              <=== ¤W­±ªº 0,    OK
    ByVal dwTimeout As Long _          <=== ¤W­±ªº 2500, OK
                           ) As Long

¦Ü©ó VbMsgBoxStyle?
¦b http://www.codeproject.com/Articles/7914/MessageBoxTimeout-API
¤W¬Ý¨ì : uiFlags = MB_YESNO|MB_SETFOREGROUND|MB_SYSTEMMODAL|MB_ICONINFORMATION
¥B
http://www.pinvoke.net/default.aspx/user32/MessageBoxTimeout.html?diff=y
¤W¬Ý¨ì¸Ó°Ñ¼Æ¥i©w¸q¬° ByVal MessageBoxOptions As Long
©Ò¥H¦Ü¤Ö¨ºÀ³¸Ó¬O­Ó¼Æ¦r¦Ó«D¤å¦r¤~¬O,
¦Ó¦b http://baike.baidu.com/view/5079352.htm
³o¸Ì¦³¸Ô²Ó»¡©ú¦U­Ó¼Æ­Èªº©w¸q.

¦Ü©ó sStr «hÀ³©ñ¦b lpText As String ¤W.

ºî¤W§A¥i¥H¸Õ¸Õ :

MsgBoxTest 0, sStr, "´£¥Ü°T®§", 0, 0, 2500

3. FindWindow ­n¥ýª¾¹D¸Óµøµ¡ªº handle ©Î¬O ¨¬¸ê¿ëÃѸӵøµ¡ªº¸ê®Æ¤~¯à§ä¨ì¸Óµøµ¡,
³o­Ó§Ú­n¦A¬d¬d¬Ý¬O§_¦³¥i¯à¸Ñ¨M.

TOP

1ºî¤W§A¥i¥H¸Õ¸Õ :
MsgBoxTest 0, sStr, "´£¥Ü°T®§", 0, 0, 2500.
luhpro µoªí©ó 2013-8-22 23:56


ÁÂÁ¤w¸g¸Ñ¨M
MsgBoxTest ·|¦Û°ÊÃö³¬µøµ¡,À³¸Ó¬OMsgBoxTest¿W¥ß¦b¶]
¦³¨â­Ó¤p¯ÊÂI
1¦³®É´£¥Ü®ÉµLªk¦b³Ì«e´º??
2´£¥Ü®É¡A·|¥X²{º|¤æª¬¡A¨S¿ìªk°µ¨ä¥L¨Æ±¡¡A¦ý¨S®t¡A¥u¦³´X¬í¦Ó¤w

TOP

ÁÂÁ¤w¸g¸Ñ¨M
MsgBoxTest ·|¦Û°ÊÃö³¬µøµ¡,À³¸Ó¬OMsgBoxTest¿W¥ß¦b¶]
¦³¨â­Ó¤p¯ÊÂI
1¦³®É´£¥Ü®ÉµLªk¦b³Ì«e´º??
2´£¥Ü®É¡A·|¥X²{º|¤æª¬¡A¨S¿ìªk°µ¨ä¥L¨Æ±¡¡A¦ý¨S®t¡A¥u¦³´X¬í¦Ó¤w
t8899 µoªí©ó 2013-8-23 09:13

1. ¥»¨Ó­Y§A¥Îªº¬O MsgBox ¨ç¼Æ, «h¦b MsgBox ¨ç¼Æ ªº»¡©ú¤¤¦³¼g¨ì :
»yªk
MsgBox(prompt[, buttons] [, title] [, helpfile, context])
buttons ¤Þ¼Æªº³]©w¦³¥H¤U´X­Ó¡G
¨ä¤¤¦³ :
VbMsgBoxSetForeground 65536 «ü©w°T®§¤è¶ôµøµ¡§@¬°«e´ºµøµ¡¡C
¥ç§Y§Aµ{¦¡¥u­n¦b ²Ä¤G­Ó°Ñ¼Æ¥[¤W + VbMsgBoxSetForeground §Y¥iÅý¦¹°T®§Åã¥Ü¦b³Ì¤W¼h.
¦ý¦p¤µ§A¥Îªº¬O¥t¤@­ÓWindows API¨ç¼Æ,
³o­Ó¨ç¼Æ§Ú§ä¤£¨ì­þ¸Ì¦³¸û¸Ô²Óªº»¡©ú,
©Ò¥H´N»Ý­n§A¦Û¤v´ú¸Õ¬Ý¬Ý¸Ó¨ç¼Æ¬O§_¦³³o­Ó¥\¯à¤F.

2. ¦P¤W,³o­Ó°ÝÃD§Ú¤]¤£ª¾¹D¦p¦ó³B²z.

TOP

¥»©«³Ì«á¥Ñ t8899 ©ó 2013-8-27 06:11 ½s¿è
1. ¥»¨Ó­Y§A¥Îªº¬O MsgBox ¨ç¼Æ, «h¦b MsgBox ¨ç¼Æ ªº»¡©ú¤¤¦³¼g¨ì :
»yªk
MsgBox(prompt[, buttons] [ ...
luhpro µoªí©ó 2013-8-26 22:54


§ä¨ì¤F  ====> vbSystemModal À³¥Îµ{¦¡±j¨î¦^À³¡G¨Ï¥ÎªÌ¥²¶·¥ý¦^À³¦¹°T®§¤è¶ô¡A¤~¯à¦b¥Ø«eªºÀ³¥Îµ{¦¡¤¤Ä~Äò¤u§@
¨S¥[vbSystemModal,°T®§µøµ¡¥X²{®É¡AÂI¨ä¥L³nÅ鬰active¡Aexcelªº°T®§µøµ¡´NµLªk¦b³Ì«e­±
·N§Y¤£ª¾¹D¦³¦¹°T®§..
MsgBoxTest 0, sStr, "´£¥Ü°T®§",vbSystemModal, 0, 2500  ====>³o¬OOK
MsgBoxTest ³o­ÓAPI (À³¸Ó¤w¥]§tMSGBOXªº©Ò¦³¥\¯à,¤£µMvbSystemModalµLªk§@¥Î¤~¹ï?)

VbMsgBoxSetForeground 65536 «ü©w°T®§¤è¶ôµøµ¡§@¬°«e´ºµøµ¡ ¡AÀ³¸Ó¤]¥i¥H±¾¦bvbSystemModal ¦Pµ¥¦ì¸m
MsgBoxTest 0, sStr, "´£¥Ü°T®§",VbMsgBoxSetForeground , 0, 2500
´ú¸Õ¤F¤@¤U¨S§@¥Î

TOP

        ÀR«ä¦Û¦b : ¨C¤ÑµL©Ò¨Æ¨Æ¡A¬O¤H¥Íªº®ø¶OªÌ¡A¿n·¥¡B¦³¥Î¤~¬O¤H¥Íªº³Ð³yªÌ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD