Board logo

¼ÐÃD: [µo°Ý] ¦p¦ó§Q¥Î°j°é©Î¨ä¥L¤è¦¡¿ï¨ú¤é´Á½d³ò¦Û°Ê¿é¤Jinputbox [¥´¦L¥»­¶]

§@ªÌ: ten999    ®É¶¡: 2011-7-15 18:22     ¼ÐÃD: ¦p¦ó§Q¥Î°j°é©Î¨ä¥L¤è¦¡¿ï¨ú¤é´Á½d³ò¦Û°Ê¿é¤Jinputbox

½Ð°Ý¦p¦ó§Q¥Î°j°é©Î¨ä¥L¤è¦¡¿ï¨ú¤@¤é´Á½d³ò¦Û°Ê¿é¤Jinputbox¹ï¸Ü¤è¶ô¤º
¦]¬°¤â°Ê¿é¤J¤é´Á¤Ó¦h
ÁÂÁÂ
§Ú·Q­n¨ú±o¤T¤jªk¤Hª÷ÃB²Î­p(ÃÒ¥æ©Ò)
§@ªÌ: Hsieh    ®É¶¡: 2011-7-15 18:51

¦^´_ 1# ten999
  1. Sub testCr()
  2. Dim selDate As String
  3.     selDate = InputBox("¤é´Á(®æ¦¡¬°yyyy/mm/dd)" & "½Ð¿é¤J¤@­Ó¤é´Á")
  4.     Do Until Not selDate Like "????/??/??"
  5.     saveCSVfmURL CDate(selDate)
  6.     selDate = InputBox("¤é´Á(®æ¦¡¬°yyyy/mm/dd)" & "½Ð¿é¤J¤@­Ó¤é´Á")
  7.     Loop
  8. End Sub
½Æ»s¥N½X

§@ªÌ: ten999    ®É¶¡: 2011-7-16 08:08

ÁÂÁÂHsieh±Ð¾É,¨Ï§Ú¿é¤J¸ê®Æ¸û¤è«K.
¥t¥~¦A¦¸½Ð°Ý§Ú¥i¥u¿é¤J "¶}©l"¤é´Á ¤Î"µ²§ô"¤é´Á ´N¦n¶Ü?
¦A¦¸·PÁÂ!
§@ªÌ: ten999    ®É¶¡: 2011-7-16 08:12

¸É¥R»¡©ú:¥i½Ð±Ð¦U¦ì¥ý¶i
¦p¦ó§Q¥Î"¤é´Á®É¶¡"µ¥excel¤½¦¡¦Û°Ê§ì¨ú«D¤u§@¤Ñ¤é´Á½d³ò¤Î¼Æ¶q!
§@ªÌ: hugh0620    ®É¶¡: 2011-7-18 11:21

¼Ó¥D~ «Øij§A~ ¦pªG¦³»Ý­n¤HÀ°§A¦A³B²z«áÄò°ÝÃD~
¥i¥H¥Î[¦^´_]ªº¤è¦¡~ ³o¼ËHsieh¤j¤j¤~·|ª¾¹D§AÁÙ¦³°ÝÃDÁÙ¨S¦³³B²z¦n~
¥L¦³®É¶¡·|¦AÀ°§A³B²z~
§@ªÌ: ten999    ®É¶¡: 2011-7-18 13:13

½Ð°Ý§Ú¬O§_¥i¥H¥u¿é¤J"¶}©l¤Îµ²§ô¤é´Á"´N¦n,¦]¬°¤é´Á½d³ò¸û¤j
¦P®É¦³«D¤u§@¤é¤Ñ¼Æ°ÝÃD
§@ªÌ: Hsieh    ®É¶¡: 2011-7-18 15:05

¦^´_ 6# ten999
³o°ÝÃD¨Ã¨S¬Æ»ò¤j§Þ¥©
´N³æ¯Â¨Ï¥ÎINPUTBOX§@¬°¿é¤J°_©l¤é´Á»Pµ²§ô¤é´Á
¥Î°j°éFor....Next±Ô­z
  1. Sub testCr()
  2. Dim selDate As Date,°_©l¤é´Á as Date, µ²§ô¤é´Á as date
  3. °_©l¤é´Á=inputbox("¿é¤J°_©l¤é´Á")
  4. µ²§ô¤é´Á=inputbox("¿é¤J µ²§ô¤é´Á")
  5. For selDate=°_©l¤é´Á to µ²§ô¤é´Á
  6. saveCSVfmURL selDate
  7. Next
  8. End Sub
½Æ»s¥N½X

§@ªÌ: ten999    ®É¶¡: 2011-7-19 11:44

¦Ò¼{¬P´Á¤» ¬P´Á¤é §Q¥Îweekday¨ç¼Æ¨ú±o¬P´Á¤»¤é
    Sub testCr()
Dim selDate As Date, °_©l¤é´Á As Date, µ²§ô¤é´Á As Date
°_©l¤é´Á = InputBox("¿é¤J°_©l¤é´Á")
µ²§ô¤é´Á = InputBox("¿é¤J µ²§ô¤é´Á")
For selDate = °_©l¤é´Á To µ²§ô¤é´Á
If Weekday(selDate) = 1 Then
Debug.Print selDate
ElseIf Weekday(selDate) = 7 Then
Debug.Print selDate
ElseIf Weekday(selDate) = 2 Then
saveCSVfmURL selDate
ElseIf Weekday(selDate) = 3 Then
saveCSVfmURL selDate
ElseIf Weekday(selDate) = 4 Then
saveCSVfmURL selDate

ElseIf Weekday(selDate) = 5 Then
saveCSVfmURL selDate

ElseIf Weekday(selDate) = 6 Then
saveCSVfmURL selDate
End If
Next
End Sub
§@ªÌ: ten999    ®É¶¡: 2011-7-19 11:46

¸É¥R»¡©ú:
¤W¦Cµ{¦¡¥i§_¨ä¥L¤è¦¡Â²¤Æ
¤Î¦p¦ó¨ú±o¯S©w°²¤é(¦p:¤¸¥¹ 228 ......)
ÁÂÁÂ!
§@ªÌ: Hsieh    ®É¶¡: 2011-7-19 14:06

¥»©«³Ì«á¥Ñ Hsieh ©ó 2011-7-19 14:12 ½s¿è

¦^´_ 9# ten999

«Øij¨Ï¥Î°²´Áªí¦C¤è¦¡
§PÂ_°j°é¤¤ÅÜ¼Æ ¬O§_¬°°²´Áªí¤º¤é´Á
  1. Sub testCr()
  2. Dim selDate As Date, °_©l¤é´Á As Date, µ²§ô¤é´Á As Date, °²´Á
  3. °²´Á = Array("01/01", "02/28", "04/05", "10/10")
  4. °_©l¤é´Á = InputBox("¿é¤J°_©l¤é´Á")
  5. µ²§ô¤é´Á = InputBox("¿é¤J µ²§ô¤é´Á")
  6. For selDate = °_©l¤é´Á To µ²§ô¤é´Á
  7. If Weekday(selDate, 2) <= 5 And IsError(Application.Match(Format(selDate, "mm/dd"), °²´Á, 0)) Then saveCSVfmURL selDate
  8. Next
  9. End Sub
½Æ»s¥N½X

§@ªÌ: ten999    ®É¶¡: 2011-7-23 08:33

¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-7-23 09:09 ½s¿è

¦^´_ 10# Hsieh

ÁÂÁÂHsieh¦^´_¤Î±Ð¾ÇÅý§Ú¸Ñ¨M°ÝÃD.
½Ð°Ý¥t¥~«ä¦Ò¤è¦¡:¬O§_¥i§Q¥Î«Ø¥ßsheet¤u§@ªí¤è¦¡(°Ñ¦ÒÃÒ¥æ©Ò¤º¦³¦~«×¥ð¥«¤é´Á)±N¦U¦~«×(¦p:2002-2011¦~)¯S©w°²¤é»s§@ªí®æÅýµ{¦¡°õ¦æ¹Lµ{¥i¥ý§PÂ_¨äªí®æ¤º½d³ò­È¬O§_¬Û¦P¦A°õ¦æ.(¦]¬°¦~«×°²¤é¤¤¦³³¡¤À¼u©Ê¥ð°²¤Î¸É¥æ©ö¤é¦]¯À,¦P®É¹³ºÝ¤È ¤¤¬î ¹A¾ä¬K¸`¦U¦~«×¤é´Á¨Ã¤£¦P)
ÁÂÁÂ
¤é´Áªí®æ¦pªþ¥ó(«D¥æ©ö¤é¤£¶}½L ¸É¥æ©ö¤é(¸g±`¬O§Q¥Î¬P´Á¤»)
[attach]7115[/attach]
§@ªÌ: GBKEE    ®É¶¡: 2011-7-23 11:03

¦^´_ 11# ten999
¸Õ¸Õ¬Ý
  1. Sub testCr()
  2.     Dim selDate As Date, °_©l¤é´Á As Date, µ²§ô¤é´Á As Date
  3.     Dim Rng As Range
  4.     On Error Resume Next    'ªí¥Ü·í¤@­Ó°õ¦æ¶¥¬q¿ù»~²£¥Í®É¡Aµ{¦¡±±¨î¥ß¨è¨ìµo¥Í¿ù»~³¯­z¦¡±µ¤U¥hªº³¯­z¦¡¡A¦ÓÄ~Äò°õ¦æ¤U¥h
  5.     °_©l¤é´Á = InputBox("¿é¤J°_©l¤é´Á")
  6.     If °_©l¤é´Á = False Then Exit Sub
  7.     µ²§ô¤é´Á = InputBox("¿é¤J µ²§ô¤é´Á")
  8.     If µ²§ô¤é´Á = False Then Exit Sub
  9.     On Error GoTo 0             '°±¤î²{¦bµ{§ÇùØ¥ô¦ó¤w±Ò°Êªº¿ù»~³B²zµ{¦¡
  10.     For selDate = °_©l¤é´Á To µ²§ô¤é´Á
  11.         Set Rng = Sheets("«D¥æ©ö¤é").Cells.Find(selDate, LookIn:=xlValues)  '¦b«D¥æ©ö¤é¤¤´M§ä¤é´Á
  12.         If Rng Is Nothing Then                                              '«D¥æ©ö¤é¤¤§ä¤£¨ì¤é´Á
  13.             Select Case Weekday(selDate)
  14.                 Case 2 To 6                                                 '¶g¤@¨ì¶g¤­
  15.                     saveCSVfmURL selDate
  16.                 Case Else    '-> Case 1 , 7                                 '°²¤é
  17.                     Set Rng = Sheets("¸É¥æ©ö¤é").Cells.Find(selDate, LookIn:=xlValues)     '°²¤é¤¤´M§ä¸É¥æ©ö¤é¤é´Á
  18.                     If Not Rng Is Nothing Then saveCSVfmURL selDate         '§ä¨ì¤é´Á
  19.             End Select
  20.         End If
  21.     Next
  22. End Sub
½Æ»s¥N½X

§@ªÌ: Hsieh    ®É¶¡: 2011-7-23 11:04

¦^´_ 11# ten999
¤W¯Z¤é¡B¥ð°²¤é¦b¥xÆW¹ê¦æªº¬O¦³ÂI¶Ã
¦ý¬O¡A´Nµ{¦¡³]­p¦Ó¨¥¡A·íµL³W«h¥i´`®É´N¥Î¦Cªí¸Ñ¨M
¨º»ò¦Cªíªº®æ¦¡´N§ñÃö«°¥«¹B¦æ¬O§_¶¶ºZ
¤£³W«hªº±ø¥ó­n¥Î¦Cªíªº·N¸q¦b©ó®e©ö§ä¥X³W«h
¦ý§Aªº³]­p¤Ï¦ÓÅý¦Cªí½ÆÂø¡A«Øij¥u¥Î2Äæ¦ì¨Ó°O¿ý°²¤é
[attach]7120[/attach]
  1. Sub testCr()
  2. Dim selDate As Date, °_©l¤é´Á As Date, µ²§ô¤é´Á As Date
  3. °_©l¤é´Á = InputBox("¿é¤J°_©l¤é´Á", , 2001 / 12 / 29)
  4. µ²§ô¤é´Á = InputBox("¿é¤J µ²§ô¤é´Á", , Date)
  5. For selDate = °_©l¤é´Á To µ²§ô¤é´Á
  6. If IsError(Application.Match(CDbl(selDate), Sheets("¥æ©ö²§°Êªí").[A:A], 0)) Then
  7.    If Weekday(selDate, 2) < 6 Or IsNumeric(Application.Match(selDate, Sheets("¥æ©ö²§°Êªí").[B:B], 0)) Then
  8.       saveCSVfmURL selDate
  9.    End If
  10. End If
  11. Next
  12. End Sub
½Æ»s¥N½X

§@ªÌ: ten999    ®É¶¡: 2011-7-23 15:12

¦^´_ 13# Hsieh


ÁÂÁ Hsieh ¤ÎGBKEE¨â¦ì±Ð¾É !
½Ð±Ð¦p¦ó±N¤@­Ó¸ê®Æ§¨¤º«Ü¦hµ§ªºcsvÀÉ(¦WºÙ¬°¤é´Á¼Ë¦¡ 20110103ms.csv  20110104ms.csv-------)¨Ì ¦~«× ¤ë¥÷ ²Ä´X©P¤Àªù§OÃþ
¨Ò¦p c:/test/2011/01/²Ä¤@©P,c:/test/2011/01/²Ä¤G©P --- c:/test/2011/02/²Ä¤@©P c:/test/2011/02/²Ä¤G©P-----
¦]¬°»Ý­nÆ[¹îªøµu´Á¦¨¥æ¶qª÷ÃB
ÁÂÁÂ
§@ªÌ: ten999    ®É¶¡: 2011-7-27 15:17

§Q¥Î¤U¦Cvba±N¼Æ¤d­ÓcsvÀÉ(¦P¤@¸ê®Æ§¨¤º)¨Ì¦~«×¤ë¥÷«Ø¥ß¸ê®Æ§¨
·Q½Ð°Ýµ{¦¡½X¤¤#6¦CA = Mid(F, InStr(F, "2004"))  ¤¤2004¬°¤â°Ê¿é¤J(µ{¦¡½X½s¿èµøµ¡/°»¿ù/³v¦æ) ,¬O§_¦³¨ä¥L¤è¦¡¥i§ïµ½!
ÁÂÁ         
Sub Ex()  
    Dim fs As Object, F As Object, A$, MyPath$
    MyPath = ThisWorkbook.Path                           
   Set fs = CreateObject("Scripting.FileSystemObject")   
    For Each F In fs.GetFolder(MyPath).Files
        If InStr(F, ".csv") Then   
            A = Mid(F, InStr(F, "2004"))            
            'A = Replace(A, ".csv", "")               
           ' A = Replace(A, "-", "\")               
            If fs.FolderExists(MyPath & "\" & Mid(A, 1, 4)) = False Then
             ChDir MyPath                        
            MkDir MyPath & "\" & Mid(A, 1, 4)              
            End If
            If fs.FolderExists(MyPath & "\" & Mid(A, 1, 4) & "\" & Mid(A, 5, 2)) = False Then                      ChDir MyPath & "\" & Mid(A, 1, 4)
                MkDir MyPath & "\" & Mid(A, 1, 4) & "\" & Mid(A, 5, 2)
            End If
            'If fs.FolderExists(MyPath & "\" & A) = False Then   
                'ChDir MyPath & "\" & Mid(A, 1, 7)
               ' MkDir MyPath & "\" & A
            'End If
            fs.moveFile F, MyPath & "\" & Mid(A, 1, 4) & "\" & Mid(A, 5, 2) & "\"  
        End If
    Next
    ChDir MyPath                                   
End Sub
§@ªÌ: ten999    ®É¶¡: 2011-7-30 16:34

¦^´_ 15# ten999
°Ñ¦Ò Hsieh ±Ð¾Ç  ÀÉ®×¾Þ§@½d¨Ò (Dir / Filesystem Object  Dir ¶i¶¥À³¥Î½d¨Ò¦C¥X«ü©w¥Ø¿ý¤§¤U©Ò¦³ªº¤l¸ê®Æ§¨¤º®e)
±N¼Æ­Ó¸ê®Æ§¨(2004\04\200404total.xls -- 2004\05\200405total.xls--2005\01\200501total.xls----¤U¼Æ­Ó¯S©wÀÉ®×(*\*\*total.xls)¦Cªí©ósheet1¤º!

½Ð°Ý¦p¦ó¨Ì§Ç¶}±Ò³o¨ÇÀÉ®×(*total.xls)±N©T©wªºµ{¦¡½X(ªþ¥ó¤º¼Ò²Õ:module3)¼g¤J³o¨ÇÀɮפº°õ¦æ¯S©w¤u§@«áÃö³¬!
ÁÂÁÂ!




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