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

[µo°Ý] ÀɦW¤£¦P¦p¦ó§PÂ_

[µo°Ý] ÀɦW¤£¦P¦p¦ó§PÂ_

½Ð¨D¦U¦ì¤j¤jªºÀ°¦£
§Ú¦³­ÓÀɮצ­¤W·|¥h¶}°_¨ä¥LÀÉ®×¼´¸ê®Æ
¦³¤@­Ó¥~³æ¦ìªºÀɮ׬ðµM§ï¤FÀɦW
½Ð°Ý­n¦p¦óÅý¨t²Î§PÂ_§ä¤£¨ì"ÀɦWA"´N¥h§ä"ÀɦWB"

³o¬O­ì¥ýªºÀɦW"¤é´Á+ªÅ®æ+¦W"
¤»´T²§°Êªí.PNG

¤µ¤Ñ²ö¦W§ï¤FÀɦW"¤é´Á+¦W"
¤»´T²§°Êªí2.PNG

Dim T$, B$, i%
T = "\\shl-group.com\dept\MFMG\B.¦U²Õ¸ê®Æ (Team inform)\E.¥ÍºÞ²Õ (PPC group)\X.¦Û°Ê¤Æ¤u¨ã(¤Å§R)\¼Ò¨ã²§°Ê-¤»ºÖ(«æ¥ó1.9±M¥Î)\"
For i = 0 To 10
   B = Format(Date - i, "yyyy.mm.dd")
   If Dir(T & B & " ¨C¤é¼Ò¨ã²§°Ê.xlsx") <> Empty Then GoTo i01

Next
MsgBox "§ä¤£¨ì " & Date & " ~ " & Date - 10 & " ÀÉ®×": Exit Sub
i01: Workbooks.Open filename:=T & B & " ¨C¤é¼Ò¨ã²§°Ê.xlsx", ReadOnly:=True

¦^´_ 1# cowww


   
Dim T$, B$, i%
T = "\\shl-group.com\dept\MFMG\B.¦U²Õ¸ê®Æ (Team inform)\E.¥ÍºÞ²Õ (PPC group)\X.¦Û°Ê¤Æ¤u¨ã(¤Å§R)\¼Ò¨ã²§°Ê-¤»ºÖ(«æ¥ó1.9±M¥Î)\"
For i = 0 To 10
   B = Format(Date - i, "yyyy.mm.dd")
   If Dir(T & B & " ¨C¤é¼Ò¨ã²§°Ê.xlsx") <> Empty Then GoTo i01
   If Dir(T & B & "¨C¤é¼Ò¨ã²§°Ê.xlsx") <> Empty Then GoTo i02
Next
MsgBox "§ä¤£¨ì " & Date & " ~ " & Date - 10 & " ÀÉ®×": Exit Sub
i01: Workbooks.Open filename:=T & B & " ¨C¤é¼Ò¨ã²§°Ê.xlsx", ReadOnly:=True:Exit Sub
i02: Workbooks.Open filename:=T & B & "¨C¤é¼Ò¨ã²§°Ê.xlsx", ReadOnly:=True
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 2# Andy2483

«D±`·PÁÂAndy2483¤j¤jªº¸Ñ´b

§Ú¬ðµM·Q¨ì­Ó°ÝÃD¡A¦pªG¶}±ÒªºÀɦW¸ò"½Æ»s"&"Ãö³¬"ªºÀɦW¤£¤@¼Ë
°õ¦æ®É¬O¤£¬O·|¥X²{²§±`
'½Æ»s2023.04.13 ¨C¤é¼Ò¨ã²§°Ê.xlsx¤¤LF¤u§@ªíªºAÄæ¨ìAGÄæ
Workbooks(B & " ¨C¤é¼Ò¨ã²§°Ê.xlsx").Worksheets("LF").Columns("A:AG").Cells.Copy

'Ãö³¬¤»´T²§°Êªí
Workbooks(B & " ¨C¤é¼Ò¨ã²§°Ê.xlsx").Close

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-4-25 11:51 ½s¿è

¦^´_ 3# cowww


   
On Error Resume Next
Workbooks(B & " ¨C¤é¼Ò¨ã²§°Ê.xlsx").Close
Workbooks(B & "¨C¤é¼Ò¨ã²§°Ê.xlsx").Close
On Error Goto 0

===========================
¸É¥R:
«Øij«e½ú¥ý¥i¥H¥Î¤§«á¦A¬ã¨s¦p¦ó²¤Æ,Åý§ó©öµøŪ
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 4# Andy2483


¦¨¥\¤F
«D±`·PÁÂAndy2483¤j¤jªº¸Ñ´b

TOP

¥»©«³Ì«á¥Ñ ­ã´£³¡ªL ©ó 2023-4-25 19:55 ½s¿è

Dim T$, B$, i%, xBook as workbook
T = "\\shl-group.com\dept\MFMG\B.¦U²Õ¸ê®Æ (Team inform)\E.¥ÍºÞ²Õ (PPC group)\X.¦Û°Ê¤Æ¤u¨ã(¤Å§R)\¼Ò¨ã²§°Ê-¤»ºÖ(«æ¥ó1.9±M¥Î)\"
For i = 0 To 10
   B = Format(Date - i, "yyyy.mm.dd")
   If Dir(T & B & " ¨C¤é¼Ò¨ã²§°Ê.xlsx") <> "" Then
      set xBook=Workbooks.Open(T & B & " ¨C¤é¼Ò¨ã²§°Ê.xlsx", ReadOnly:=True)
      exit for
Next
if xbook is nothing then MsgBox "§ä¤£¨ì¥Ø¼ÐÀÉ®×": Exit Sub
xbook.sheets("LF").Columns("A:AG").Cells.Copy
~~do something ~~
xbook.Close 0

TOP

¦^´_ 6# ­ã´£³¡ªL
¦^´_ 5# cowww


    ÁÂÁ½׾Â,ÁÂÁ«e½ú«ü¾É
«á¾Ç¾Ç²ß¤ß±oµù¸Ñ¦p¤U,½Ð«e½ú¦A«ü±Ð



Option Explicit
Sub TEST()
Dim T$, B$, i%, xBook As Workbook
'¡ô«Å§iÅܼÆ:(T,B)¬O¦r¦êÅܼÆ,i¬Oµu¾ã¼Æ,xBook¬O¬¡­¶Ã¯ÅܼÆ
T = "\\shl-group.com\dept\MFMG\B.¦U²Õ¸ê®Æ (Team inform)\E.¥ÍºÞ²Õ (PPC group)\X.¦Û°Ê¤Æ¤u¨ã(¤Å§R)\¼Ò¨ã²§°Ê-¤»ºÖ(«æ¥ó1.9±M¥Î)\"
'¡ô¥OT³o¦r¦êÅܼƬO ¸ô®|¦r¦ê
For i = 0 To 10
'¡ô³]¶¶°j°é!i±q0¨ì 10
   B = Format(Date - i, "yyyy.mm.dd")
   '¡ô¥OB³o¦r¦êÅܼƬO ¤µ¤Ñ¤é´Á-iÅܼƫá,
   'Âà´«¬°4½X¦è¤¸¦~,2½X¤ë,2½X¤é,¤¤¶¡ÂI¶¡¹jªº¦r¦ê

   If Dir(T & B & " ¨C¤é¼Ò¨ã²§°Ê.xlsx") <> "" Then
   '¡ô¦pªGTÅܼƳs±µBÅܼÆ,¦A³s±µ" ¨C¤é¼Ò¨ã²§°Ê.xlsx"²Õ¦¨·s¦r¦ê¬d¨ì³oÀÉ®×?
      Set xBook = Workbooks.Open(T & B & " ¨C¤é¼Ò¨ã²§°Ê.xlsx", ReadOnly:=True)
      '¡ô¥OxBook³o¬¡­¶Ã¯ÅܼƬO³Q¥´¶}ªº,
      '³Q¥´¶}ªºTÅܼƳs±µBÅܼÆ,¦A³s±µ" ¨C¤é¼Ò¨ã²§°Ê.xlsx"²Õ¦¨·s¦r¦êªºÀÉ®×

      Exit For
      '¡ôµ²§ô°j°é
   End If
Next
If xBook Is Nothing Then MsgBox "§ä¤£¨ì¥Ø¼ÐÀÉ®×": Exit Sub
'¡ô¦pªGxBookÅܼƬO¨S¦³¸ü¤Jª«¥ó!´N¸õ¥X´£¥Üµ¡,µ²§ôµ{¦¡°õ¦æ
xBook.Sheets("LF").Columns("A:AG").Cells.Copy
'¡ôÄ~Äò¥HÅܼÆxBook«ü¦V¥Ø¼Ð¥i¥HÅýµ{¦¡Â²¼ä©öµøŪ
'~~do something ~~
xBook.Close 0
'¡ô¥OxBook¤£¦sÀÉ Ãö³¬
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 6# ­ã´£³¡ªL

«D±`·PÁ­㴣³¡ªL¤j¤jªº¸Ñ´b
¦ý¬O
§ä¤£¨ìÀÉ®×­C
§ä¨B¹D.PNG
LF.PNG

TOP

¦^´_ 8# cowww


    ¤µ¤Ñ­n§ìªºÀɦW  " ¨C¤é¼Ò¨ã²§°Ê.xlsx" «e¤è¦³ªÅ¥Õ¦r¤¸¶Ü?
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 9# Andy2483

¨S¦³ªÅ¥Õ¦r¤¸
LF.PNG

TOP

        ÀR«ä¦Û¦b : ¡i¦æµ½­n¤Î®É¡j¦æµ½­n¤Î®É¡A¥\¼w­n«ùÄò¡C¦p¿N¶}¤ô¤@¯ë¡A¥¼¿N¶}¤§«e¤d¸U¤£­n°±º¶¤õ­Ô¡A§_«h­«¨Ó´N¤Ó¶O¨Æ¤F¡C
ªð¦^¦Cªí ¤W¤@¥DÃD