Board logo

¼ÐÃD: ¦p¦ó§ó§ï¨ä¥LªÑ¸¹¡A­n­þ¨Ç¨BÆJ¡H [¥´¦L¥»­¶]

§@ªÌ: cfuxiong    ®É¶¡: 2012-4-26 21:37     ¼ÐÃD: ¦p¦ó§ó§ï¨ä¥LªÑ¸¹¡A­n­þ¨Ç¨BÆJ¡H

½Ð±Ðª©¤j°ª¤â«üÂI¡FÁÂÁÂ~~
1.§Ú¦b[¶×¤J]Äæ¡A¾Þ§@[¸ê®Æ]¡÷[¶×¤J¥~³¡¸ê®Æ]¡÷[½s¿è¬d¸ß]¡÷§â[2303Áp¹q]§ï¦¨[2330¥x¿n¹q]¡÷[°O¿ý]Äæ«o¤£¯à§ó·s¦¨[2330¥x¿n¹q]Data¡A5¤ÀÄÁ«á¤SÁÙ­ì[2303Áp¹q]½Ð°Ý¦p¦ó³B¸m¡H§ó§ï¨ä¥LªÑ¸¹¡A­n­þ¨Ç¨BÆJ¡H
2.½d¨Ò¡G10¬í§ó·s¸ê®Æ=>Application.OnTime Now + TimeValue("00:00:10"), "MyDee"  '³]©w 10¬í«á °õ¦æ MyDee µ{§Ç
    Exit Sub
­n§ï¦¨5¤À§ó·s¸ê®Æ=>Application.OnTime Now + TimeValue("00:05:00"), "MyDee"  '³]©w 5¤À«á °õ¦æ MyDee µ{§Ç
³o¼Ë¹ï¶Ü¡H­n¦p¦ó¦sÀÉ¡H
§@ªÌ: c_c_lai    ®É¶¡: 2012-4-27 07:55

¦^´_ 1# cfuxiong
¨º§A¬°¦ó¤£³o»ò°µ¡G °²³]¦b§Aªº "¶×¤J" ¤u§@ªí³æ¤ºªº P1 Äæ¦ì¿é¤J -> "®É¬q³]©w"¡A  P2 Äæ¦ì¿é¤J -> "00:05:00"¡A¦Ó±N
Application.OnTime Now + TimeValue("00:00:10"), "MyDee" ­×§ï¦¨
Application.OnTime (Now + Sheets("¶×¤J").Range("P2").Value), "ThisWorkBook.MyDee"¡A¦p¦¹¡A¥H«á¥u­n§A¤£°ª¿³´N¨ì
P2 Äæ¦ì¨Ó­×§ï§A°ª¿³ªº³]©w®É¬q¡A¨º¤£´Nµ²¤F¡I
§@ªÌ: cfuxiong    ®É¶¡: 2012-4-27 10:54

¦^´_ 2# c_c_lai
ÁÂÁÂc_c_laiªº«ü¾É»PÀ°¦£¡A¨ì¥Ø«e¬°¤î¡A¥Î¡mApplication.OnTime Now + TimeValue("00:05:00"), "MyDee"  '³]©w 5¤À«á °õ¦æ MyDee µ{§Ç¡n¬OOK
¤]¸Õ¹L§A«ü¾Éªº¤èªk¡A¦ý«o¥X²{¡¨¶¥¬q¿ù»~13¡¨¤£ª¾¦ó³B¥X¿ù¡H
²{¦b¬O·Q­n§ó§ï[ªÑ¸¹]«o¤£ª¾¦p¦ó¤U¤â¡F
§Ú¦b[¶×¤J]Äæ¡A¾Þ§@[¸ê®Æ]¡÷[¶×¤J¥~³¡¸ê®Æ]¡÷[½s¿è¬d¸ß]¡÷§â[2303Áp¹q]§ï¦¨[2330¥x¿n¹q]¡÷[°O¿ý]Äæ«o¤£¯à§ó·s¦¨[2330¥x¿n¹q]Data¡A5¤ÀÄÁ«á¤SÁÙ­ì[2303Áp¹q]½Ð°Ý¦p¦ó³B¸m¡H§ó§ï¨ä¥LªÑ¸¹¡A­n­þ¨Ç¨BÆJ¡HÁÂÁÂ~~
§@ªÌ: c_c_lai    ®É¶¡: 2012-4-27 11:10

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2012-4-27 11:22 ½s¿è

¦^´_ 3# cfuxiong
½Ð§A¥ýÀˬd¤@¤U
¥N¸¹ = Sheets("¬ö¿ý").[C1]

µ¥½L«á§Ú¦A¬Ý¬Ý¡A­è¤~¤@°õ¦æ§Aªºµ{¦¡¡A´N¥X²{ 400 ªº¿ù»~°T®§¡A
µ²ªG³s±aªº§Úªº§@·~µ{¦¡³ºµM¦Û°Ê°±¤î¤F§ÚªºDDE¸ê®Æ¶×¤J¡I
§@ªÌ: Hsieh    ®É¶¡: 2012-4-27 14:27

¦^´_ 3# cfuxiong

·|µo²{§ó§ïªÑ¸¹«á¤S¥X²{¥ý«eªºªÑ²¼¸ê°T¡A¦³¥i¯à¬O®É¶¡®tªºÃö«Y¡A·í«e¤@­Ó¬d¸ß©|¥¼¬d¸ßµ²§ô(¥¿¦b¬d¸ß¤¤)
§A§ó§ï¤FC1ªºªÑ¸¹³o®ÉIJµo¨Æ¥óµ{§Ç¦Ó°õ¦æ§ó·s¡Aµ²ªG¦¹¦¸§ó·s¤ñ«e¤@¦¸§ó·s³t«×§Ö¡A´N¶K¨ì¸ê®Æ°Ï¡Aµ²ªG«e¤@¦¸§ó·s±µµÛ§¹¦¨
©Ò¥H³y¦¨³o¼Ë²{¶H¡A³o»Pºô¸ô¦³Ãö¡A§A§â¬ö¿ý¤u§@ªí¨Æ¥óµ{§Ç§R°£«á°õ¦æ¬Ý¬Ý¡AÀ³¸Ó´N·|®ø°£³oºØ²{¶H
¥t´£¨ì5¤ÀÄÁ°õ¦æ¬O§ï¦¨Now + TimeValue("00:05:00")¨S¿ù
  Application.OnTime Now + TimeValue("00:05:00"), "MyDee"  '³]©w 5¤ÀÄÁ«á °õ¦æ MyDee µ{§Ç
§@ªÌ: c_c_lai    ®É¶¡: 2012-4-27 15:03

¦^´_ 3# cfuxiong
' Sh.Activate                       ' *************
' Rng.Select                        ' *************
³o¨â³B§Ú±N¥¦§ï¦¨µùÄÀ¡A¦]¬°¥¦·|±Nµe­±¤£Â_¤Á¨ì "¬ö¿ý" ¤u§@ªí³æ¡A
¦pªG§A¬O¥¿¦bÀˬd "¶×¤J"¤u§@ªí³æ®É¡A³]©w®É¬q¤@¨ìµe­±
«K·|³Q±j¨î¤Á¨ì "¬ö¿ý" ¤u§@ªí³æ¤W¡A«D±`§xÂZ¡I

' Application.OnTime Now + TimeValue("00:00:10"), "MyDee"  ­×§ï¦¨
Application.OnTime (Now + Sheets("¶×¤J").Range("P2").Value), "MyDee"
¦]¬°§Aªºµ{¦¡½X¨Ã¤£¬O©ñ¸m¦b ThisWorkBook °Ï¶ô¤º¡A©Ò¥H "ThisWorkBook.MyDee"
§ï¦¨ "MyDee"¡C
[attach]10703[/attach]
[attach]10704[/attach]
§@ªÌ: cfuxiong    ®É¶¡: 2012-4-27 15:03

¦^´_ 5# Hsieh
ÁÂÁÂHsiehª©¤j«ü¾É¡F
¡m§A§â¬ö¿ý¤u§@ªí¨Æ¥óµ{§Ç§R°£«á°õ¦æ¬Ý¬Ý¡AÀ³¸Ó´N·|®ø°£³oºØ²{¶H¡n§Ú§@¤F¥H¤U°Ê§@¡F
1.¥´¶}Àɮס÷[°±¥Î¥¨¶°]¶i¤J¡÷¦b[¶×¤J]Äæ¡A¾Þ§@[¸ê®Æ]¡÷[¶×¤J¥~³¡¸ê®Æ]¡÷[½s¿è¬d¸ß]¡÷§â[2303Áp¹q]§ï¦¨[2330¥x¿n¹q]=>µe­±¬Ý¨Ó¬OOK¡÷Àx¦s¡÷Â÷¶}¡C
2.¦A¥´¶}Àɮס÷[±Ò¥Î¥¨¶°]¶i¤J¡÷¤SÁÙ­ì±Ò©l¸ê®Æ¡C
½Ðª©¤j°ª¤â«ü¾É¡KÁÂÁÂ~~
§@ªÌ: Hsieh    ®É¶¡: 2012-4-27 16:32

¦^´_ 7# cfuxiong


   ¨Ã«D§ó§ï¬d¸ß
¦]¬°§Aªº±ø¥ó¤w¸g¦bµ{¦¡½X¤¤¨Ï¥Î¬ö¿ý¤u§@ªíC1ªº­È§@±ø¥ó
©Ò¥H¥u­n±N¬ö¿ý¤u§@ªíC1ªº­È§ï¦¨·Q­nªº¥N½X§Y¥i
§@ªÌ: cfuxiong    ®É¶¡: 2012-4-27 18:45

¦^´_ 6# c_c_lai
ÁÂÁÂc_c_laiªº«ü¾É»PÀ°¦£¡A«D±`º¡·N¡K¦A»¡ÁnÁÂÁÂ~~
§@ªÌ: cfuxiong    ®É¶¡: 2012-4-27 18:45

¦^´_ 8# Hsieh
ÁÂÁÂHsiehª©¤j²Ó¤ß«ü¾É¡F¤wOK¤F¡KÁÂÁÂ~~
§@ªÌ: GBKEE    ®É¶¡: 2012-4-27 21:05

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-4-27 21:09 ½s¿è

¦^´_ 10# cfuxiong
¸Õ¸Õ¬Ý
  1. Option Explicit             '¦b¼Ò²Õ¼h¦¸¤¤±j­¢¨C­Ó¦b¼Ò²ÕùتºÅܼƳ£¥²¶·©ú½Tªº«Å§i¡C
  2. Dim Rng As Range
  3. Private Sub AUTO_OPEN()     '¦¹¥¨¶°©óÀɮ׶}±Ò®É·|¦Û°Ê°õ¦æ
  4.     Sheets("¬ö¿ý").UsedRange.Offset(2).Clear                '²M°£ «e¤@¤éªº¼Æ¾Ú
  5. '***   Offset(1).Clear  §ï¦¨   Offset(2).Clear    '********
  6.     If Time < TimeValue("08:45") Then             '¦­©ó¶}½L®É¶¡
  7.         Application.OnTime TimeValue("08:45"), "MyDee"    '³]©w©ó08:45 °õ¦æ MyDee µ{§Ç
  8.     ElseIf Time >= TimeValue("08:45") And Time <= TimeValue("13:30") Then '©ó¥æ©ö®É¶¡¤º
  9.         MyDee                                     ' °õ¦æ MyDee µ{§Ç
  10.     End If
  11. End Sub
  12. Private Sub MyDee()
  13.     Dim Sh As Worksheet, ¥N¸¹ As String
  14.     If Time > TimeValue("13:30") Then Exit Sub     ' ¦¬½L®É¶¡«á °±¤î°õ¦æ
  15.    On Error Resume Next
  16.    Set Sh = Sheets("¬ö¿ý")
  17.     With Sh
  18.         ¥N¸¹ = .[C1]
  19.         .[C1].Select
  20.         .Activate
  21.         Application.ScreenUpdating = False
  22.         With Rng
  23.             .Interior.ColorIndex = xlNone
  24.             .Borders.LineStyle = xlLineStyleNone
  25.         End With
  26.         If Err <> 0 Then
  27.             Err.Clear
  28.             On Error GoTo 0
  29.             .UsedRange.Interior.ColorIndex = xlNone
  30.             .UsedRange.Borders.LineStyle = xlLineStyleNone
  31.         End If
  32.     End With
  33.     With Sheets("¶×¤J").QueryTables(1)
  34.         .Connection = "URL;http://tw.stock.yahoo.com/q/q?s=" & ¥N¸¹
  35.        .Refresh False
  36.         Application.EnableEvents = False
  37.         Set Rng = Sh.Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(1, .ResultRange.Columns.Count - 1)
  38.         Rng.Value = .ResultRange.Rows(3).Value
  39.         With Rng
  40.             If .Row >= 20 Then
  41.                 ActiveWindow.ScrollRow = .Row - 17
  42.             Else
  43.               ActiveWindow.ScrollRow = 3
  44.             End If
  45.             .Interior.ColorIndex = 4
  46.             .BorderAround xlContinuous, 2, 5
  47.         End With
  48.         Application.EnableEvents = True
  49.         Application.ScreenUpdating = True
  50.     End With
  51.      Application.OnTime Now + TimeValue("00:00:10"), "MyDee" '³]©w 10¬í«á °õ¦æ MyDee µ{§Ç
  52.    
  53.    '10¬íÄÁ: ¿é¤J¦¹®æ¦¡  #00:00:10# «áVBA ¦Û°Ê¥Í¦¨   ->  #12:00:10 AM#
  54.    '5¤ÀÄÁ:  ¿é¤J¦¹®æ¦¡  #00:05:00# «áVBA ¦Û°Ê¥Í¦¨   ->  #12:05:00 AM#
  55.    '1¤p®É:  ¿é¤J¦¹®æ¦¡  #1:00:00#  «áVBA ¦Û°Ê¥Í¦¨   ->  #1:00:00 AM#
  56.    
  57.     'Application.OnTime Now + #12:00:10 AM#, "MyDee" '³]©w 10¬í«á  °õ¦æ MyDee µ{§Ç
  58.     'Application.OnTime Now + #12:05:00 AM#, "MyDee" '³]©w 5¤ÀÄÁ«á °õ¦æ MyDee µ{§Ç
  59.     'Application.OnTime Now + #1:00:00 AM#, "MyDee"  '³]©w 1¤p®É«á °õ¦æ MyDee µ{§Ç
  60.    
  61.     Exit Sub
  62. End Sub
½Æ»s¥N½X

§@ªÌ: cfuxiong    ®É¶¡: 2012-4-27 22:14

¦^´_ 11# GBKEE
GRKEEª©¤j±ß¦w¡F§Ú¬O·s¤â°ÝÃD¯S§O¦h¡F½Ð°Ý¶K¤WVBAµ{¦¡¤£ª¾¦p¦óÀx¦s~~~
§Ú¾Þ§@¦p¤U[¤u¨ã]¡÷[¥¨¶°] ¡÷[VB½s¿è¾¹] ¡÷¶K¤WVBAµ{¦¡=>­n¦p¦óÀx¦s¡H
¯à§_«ü¾É¡HÁÂÁÂ~~
§@ªÌ: c_c_lai    ®É¶¡: 2012-4-27 23:02

¦^´_ 12# cfuxiong
¦^´_ 11# GBKEE
§Ú±N GBKEE ¤j¤jªºµ{¦¡ (µy¥[­×¹¢) ©ñ¤J ªÑ²¼¬ö¿ý2¡A cfuxiong ¦Ñ§Ìªº©ñ¤J¨ì ªÑ²¼¬ö¿ý1 ¤¤¡A³Ì¥ýªºÀÉ®×·íµM¬O ªÑ²¼¬ö¿ý ¤F¡C
«e¨âªÌ³£¬O±Nµ{¦¡½X©ñ¸m¦b ThisWorkbook µ{¦¡°Ï¤º°õ¦æªº¡A ¦P®É C1 Äæ¦ì²§°ÊªºÀˬdµ{¦¡½X¤]¸òµÛ­×¥¿ (­ì¥»¬O "Module1.MyDee")¡A
  1. '   Sheet2 (¬ö¿ý)  ªºµ{¦¡°Ï°ì
  2. Option Explicit

  3. Private Sub Worksheet_Change(ByVal Target As Range)
  4.     If Target(1).Cells = [C1] Then Run "ThisWorkbook.MyDee"
  5. End Sub
½Æ»s¥N½X
Ä@¨â¦ì¦³­Ó´r§Öªº©P¦ì©]±ß¡I
[attach]10707[/attach]
[attach]10705[/attach]
[attach]10706[/attach]
§@ªÌ: GBKEE    ®É¶¡: 2012-4-28 06:39

¦^´_ 12# cfuxiong
ÀH³oExcel ¦sÀÉ´N¥i¥H¦sÀÉ ©Î ¶×¥X¦sÀÉ ¨ä¥L Excel ÀÉ®× ¥i¶×¤J¨Ï¥Î
¶i¤J VBA  µøµ¡ ÁÙ¦³¤@³~®|
¦p¹Ï
[attach]10708[/attach]                         [attach]10709[/attach]
§@ªÌ: c_c_lai    ®É¶¡: 2012-4-28 07:23

¦^´_ 14# GBKEE
½Ð±Ð±z¡A¥N¸¹ = .[C1] ªº [C1] ¨ä¥»¨­¦b©w¸q¤W«üªº¬O Range ÁÙ¬O Cells¡A ¥¦­ÌÂà¥X­È·|¬O Value ÁÙ¬O Text¡H
·íµM¦b³]©w®É¡A´N¤w«D±`²M·¡¸ÓÄ檺ÄÝ©Ê¡A §Ú­n¤F¸Ñªº¬O¥¦¦bÀ³¥Î­±¤W¥¿½Tªº¨Ï¥Î¡C
Ä´¦p»¡¤§«e´£¹Lªº¡G¦pªG¸ÓÄæ¦ì¬O®É¶¡Äæ¡A¦ý¸ÓÄæ "A3" Àx¦sªº¬O "=TIME(LEFT(A2,LEN(A2)-4),MID(A2,LEN(A2)-3,2),RIGHT(A2,2))"
©Î¬O A3 ¬O Web ª½±µ¶×¤Jªº®É¶¡¡A¦ý¸ÓÄæ¦ì®æ¦¡¨Ã«D "®É¶¡"¡A¤]³\¬O "¦Û­q" ¤]»¡¤£©w¡A¨º»ò¦¹®É   ®É¶¡ = .[A3]¡A
©Ò±o¨ìªº­È·|¬O 0.604166667 ÁÙ¬O 14:30 (°²³]·í®É®É¶¡¬° 02:30:00 PM)¡H À³¸Ó¦p¦ó¥h°µ¥¿½Tªº«Å§i¡H
§@ªÌ: GBKEE    ®É¶¡: 2012-4-28 10:34

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-4-28 10:37 ½s¿è

¦^´_ 15# c_c_lai
  1. Option Explicit
  2. Sub Ex()
  3.      '[xxx]  'xxx ¬°¬¡­¶Ã¯ªºª«¥ó ©Î¨ç¼Æ  ¦ý¤£¥i¥H¬OÅܼÆ
  4.     MsgBox [max({5,100,9})]
  5.    [¬ö¿ý!B3] = 0.666
  6.     [¬ö¿ý!B3].NumberFormatLocal = "h:mm;@"
  7.     MsgBox [¬ö¿ý!B3]          '¶Ç¦^ªº¬O­È   .Value
  8.     MsgBox [¬ö¿ý!B3].Text     '¶Ç¦^ªº¶Ç¦^Àx¦s®æªº®æ¦¡   

  9.       'Rng.Value = .ResultRange.Rows(3).Value
  10.     'Rng ²Ä2­Ó¦ì¸m¬O ¼Æ­È ±N¥¦³]©w ¬°®É¶¡®æ¦¡
  11.     'Rng.Cells(2).NumberFormatLocal = "h:mm;@"
  12.    
  13. End Sub
½Æ»s¥N½X

§@ªÌ: c_c_lai    ®É¶¡: 2012-4-28 11:02

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2012-4-28 11:07 ½s¿è

¦^´_ 16# GBKEE
¸g´ú¸Õ²×©óÅé·|¤F¡A¦­°_ªº³¾¨à¯uªº¦³ÂΦY¡I

  Sub Ex()
        ' [xxx]  'xxx ¬°¬¡­¶Ã¯ªºª«¥ó ©Î¨ç¼Æ  ¦ý¤£¥i¥H¬OÅܼÆ
        ' MsgBox [max({5,100,9})]
       [¤u§@ªí1!B3] = 0.666
        [¤u§@ªí1!B3].NumberFormatLocal = "h:mm;@"
       MsgBox [¤u§@ªí1!B3]                   '¶Ç¦^ªº¬O­È   .Value                 0.666
       MsgBox [¤u§@ªí1!B3].Text          '¶Ç¦^ªº¶Ç¦^Àx¦s®æªº®æ¦¡       15:59
       [¤u§@ªí1!B4] = [¤u§@ªí1!B3]       '±a¤Jªº¬O­È   .Value                 0.666
       [¤u§@ªí1!B5] = [¤u§@ªí1!B3].Text  '±a¤Jªº¬OÀx¦s®æªº®æ¦¡       15:59
          'Rng.Value = .ResultRange.Rows(3).Value
        'Rng ²Ä2­Ó¦ì¸m¬O ¼Æ­È ±N¥¦³]©w ¬°®É¶¡®æ¦¡
        'Rng.Cells(2).NumberFormatLocal = "h:mm;@"      
    End Sub

§Ú±N MsgBox [max({5,100,9})] Marked¡Aµo²{¦n¹³µL§@¥Î¡A
½Ð°Ý¥¦¦³¦ó§@¥Î¡H
§@ªÌ: GBKEE    ®É¶¡: 2012-4-28 11:05

¦^´_ 17# c_c_lai
¨ú®øµù¸Ñ ¬Ý¬Ý
¬O»¡©ú [    ]   ªº¥Îªk
§@ªÌ: c_c_lai    ®É¶¡: 2012-4-28 11:09

¦^´_ 18# GBKEE
­ì¨Ó¬O¨ú¥X¨ä³Ì¤j­È¡C
§@ªÌ: cfuxiong    ®É¶¡: 2012-4-28 16:50

¦^´_ 17# c_c_lai
Meadª©¤jc_c_laiª©¤j¡F§A­Ì¦n¡F
·PÁ¨â¦ì¥ý¶i¤ÏÂЫü¾É¡AÅý·s¤â½m²ß¡BÅé·|
¦A¦¸¦V¨â¦ì»¡Án "·P¿E¨â¦ì¥ý¶i"¡I




Åwªï¥úÁ{ ³Â»¶®a±Ú°Q½×ª©ª© (http://forum.twbts.com/)