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

[µo°Ý] ¦p¦ó¥Î«ö¶s½Æ»sÀÉ®×?(¤w¸Ñ¨M)

[µo°Ý] ¦p¦ó¥Î«ö¶s½Æ»sÀÉ®×?(¤w¸Ñ¨M)

¥»©«³Ì«á¥Ñ iceandy6150 ©ó 2012-3-5 22:51 ½s¿è

¦U¦ì¤j¤j¦n

§Ú¦³¤@­ÓÀɮסA³Â»¶®a±Ú1¤é.xls¡A¸Ì­±sheet1§Ú©ñ¤F¤@­Ó«ö¶s

§Æ±æ«ö¤U¥h«á¡A¯à¦Û°Ê½Æ»s¦Û¤v¡A¨Ã§ó¦W¬° : ³Â»¶®a±Ú2¤é.xls

µM«á¦¹·s½Æ»s¥X¨ÓªºÀÉ®×·|©M­ì¥»ªºÀɮשñ¦b¦P¤@¸ê®Æ§¨¸Ì­±

(°²³]­ì¥»ªºÀɮצbc:\test)


¤S.....¦pªG¦¹«ö¶s¬O©ñ¦b¦P¸ê®Æ§¨¡A¦ý¥t¥~¤@­Ó A.xls¸Ì­±¡A¼gªk¤@¼Ë¶Ü?

ÁÂÁÂ
«¢Åo~¤j®a¦n§r

¦^´_ 1# iceandy6150
½Æ»sÀɮ׳̭«­n¬OÀɦW°ÝÃD
¦pªG¥H²Ä¤@¨Ò¤¤¤å¦WºÙ+¼Æ­È§@¬°ÀɦW
¥i­pºâ¦P¦WºÙÀɮ׼ƶq«á¥[¤W¸¹½X°µ¬°·sÀɮצWºÙ
  1. Private Sub CommandButton1_Click()
  2. With ThisWorkbook
  3. f = Replace(Replace(.Name, StrReverse(Val(StrReverse(Replace(.Name, ".xls", "")))), ""), ".xls", "")
  4. fs = Dir(f & "*.xls")
  5. Do Until fs = ""
  6. fs = Dir
  7. i = i + 1
  8. Loop
  9. f = .Path & "\" & f & i + 1 & ".xls"
  10. .SaveCopyAs f
  11. End With
  12. End Sub
½Æ»s¥N½X
­Y°õ¦æ¥¨¶°ªºÀɦW»P¥t¦sªºÀɮצWºÙ¨S¦³¥ô¦ó³W«h¡A¥i¯à´N­n«ü©wÀɦW¦A¥h­pºâ¦P¦W¤£¦P½s¸¹ªºÀɮ׼ƶq
¦b¥t¦s·sÀÉ
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ iceandy6150 ©ó 2012-3-4 23:38 ½s¿è

¦^´_ 2# Hsieh


    Private Sub CommandButton1_Click()
With ThisWorkbook
f = Replace(Replace(.Name, StrReverse(Val(StrReverse(Replace(.Name, ".xls", "")))), ""), ".xls", "")
                                                '¤j¤j¡A¤W­±³o¤@¨BÆJ¬O??¥Î¦n¦h¼h³á¡Cµo²{§ì¨ìªº¬O   f=³Â»¶1¤é
fs = Dir(f & "*.xls")
Do Until fs = ""
fs = Dir
i = i + 1
Loop
f = .Path & "\" & f & i + 1 & ".xls"           '³o¤@¨B¡Af=³Â»¶1¤é1.xls
.SaveCopyAs f
End With
End Sub

§Ú§¹¾ãªº¥\¯à¬O·Q­n
¨C¤ë·|¦³¤@¸ê®Æ§¨¡A¸ê®Æ§¨¸Ì­±¥u¦³ [³Â»¶1¤é.xls] ¥»¨­
³Â»¶1¤é.xls¬O·í½d¥»¡A¸Ì­±ªF¦è§ï¦n¡A«ö¤U«ö¶s«á
·|½Æ»s¦Û¤v¡AµM«á²£¥Í³Â»¶2¤é.xls¡A³Â»¶3¤é.xls......³Â»¶31¤é.xls
(§Ú»Ý­n2~31¤éªº¤º®e¡B¥\¯à³q³q¸ò1¤é¤@¼Ë¡A¤â°Ê½Æ»s¶K¤W­n30¦¸¡A©Ò¥H·Q¼gµ{¦¡)

³oÃä·Qªk¦p¤U
i=2 to 31
½Æ»s ³Â»¶1¤é.xls
§ó¦W¬°  "³Â»¶" & cstr(i) & "¤é.xls"
next i

¥t¥~¬O¨¾§b
1¤é¸Ì­±ªº«ö¶s·|²£¥Í2¤é~31¤é
2¤é~31¤éªºÀɮ׬O½Æ»s1¤éªº¡A©Ò¥H¥ô¦ó¤@¤é¤£¤p¤ß«ö¨ìªº¸Ü¡A·|¦A²£¥Í¤@¦¸2¤é~31¤é
­Y¯à°»´úÀÉ®×(2¤é~31¤é)¤w¦s¦b´N¤£¦A°õ¦æ¡A¨º´N«Ü§¹¬ü¤F


¥i¬O§Ú¤£ª¾¹D«ç»ò¼g¡A©Î¬O«ç»ò§Q¥Î¤j¤jªº¥h§ï
¦A³Â·Ð¤@¤UÅo¡AÁÂÁÂ
«¢Åo~¤j®a¦n§r

TOP

¦^´_ 3# iceandy6150
¸Õ¸Õ¬Ý
  1. Private Sub CommandButton1_Click()
  2. On Error Resume Next
  3. ph = ThisWorkbook.Path & "\"
  4. f = ThisWorkbook.Name
  5. i = 1
  6. Do Until i > Len(f) Or Not IsEmpty(n)
  7. n = Empty
  8.    n = CInt(Mid(f, i, 1))
  9.    If IsEmpty(n) Then k = k & Mid(f, i, 1)
  10.    Err.Clear
  11.    i = i + 1
  12. Loop
  13. fs = Dir(ph & k & "*.xls")
  14. Do Until fs = "" '­pºâ¦P¦WÀɮ׼ƶq
  15. fs = Dir
  16. x = x + 1
  17. Loop
  18. fs = ph & k & x + 1 & "¤é.xls"
  19. ThisWorkbook.SaveCopyAs fs
  20. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 4# Hsieh


    «e½ú§A¦n
<°ÝÃD¤@>
±zªºµ{¦¡«ö¤U¥h«á¡A­ì¦³³Â»¶1¤é.xls¤£°Ê¡A·|·s¼W³Â»¶2¤é.xls
¦A«ö¤@¦¸¡A·|·s¼W3¤é
¥i¬O§Ú·Q­n«ö¤U¥h«á·|ª½±µ·s¼W  ³Â»¶2¤é.xls~³Â»¶31¤é.xls

©ó¬O§Ú°µ¤F¤p´ú¸Õ¡A¦b±zµ{¦¡³Ì«e¥[¤F for j =2 to 5  ³Ì«á¥[ Next j  (¥ý¥Î5¦¸¸Õ¸Õ¬Ý)
µ²ªG¶]¥X¨Ó¬O 1¤é(­ì¦³ªº)  2¤é  4¤é  7¤é  11¤é
½Ð°Ý¸Ó«ç»ò§ï©O?

<°ÝÃD¤G>
¨¾§b
1¤é¸Ì­±ªº«ö¶s·|²£¥Í2¤é~31¤é
2¤é~31¤éªºÀɮ׬O½Æ»s1¤éªº¡A©Ò¥H¥ô¦ó¤@¤é¤£¤p¤ß«ö¨ìªº¸Ü¡A·|¦A²£¥Í¤@¦¸2¤é~31¤é
­Y¯à°»´úÀÉ®×(2¤é~31¤é)¤w¦s¦b´N¤£¦A°õ¦æ
½Ð°Ý¸Ó«ç»ò°µ©O?

ÁÂÁÂ
«¢Åo~¤j®a¦n§r

TOP

¦^´_ 5# iceandy6150
  1. Private Sub CommandButton1_Click()
  2. On Error Resume Next
  3. ph = ThisWorkbook.Path & "\"
  4. f = ThisWorkbook.Name
  5. i = 1
  6. Do Until i > Len(f) Or Not IsEmpty(n)
  7. n = Empty
  8.    n = CInt(Mid(f, i, 1))
  9.    If IsEmpty(n) Then k = k & Mid(f, i, 1)
  10.    Err.Clear
  11.    i = i + 1
  12. Loop
  13. p = Day(DateAdd("M", 1, Format(Date, "yyyy/m/1")) - 1)
  14. For j = 2 To p
  15. fs = ph & k & j & "¤é.xls"
  16. If Dir(fs) = "" Then ThisWorkbook.SaveCopyAs fs
  17. Next
  18. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 6# Hsieh


   ·PÁ¶W¯Åª©¥D~~¥i¥H¥Î¤F
¥H¤U¬O§Ú¹ï³o­Óµ{¦¡ªºÁA¸Ñ
¦³¤£¹ï©Î¤£À´ªº¦a¤è¡A¥i¥H½Ð¶W¯Åª©¥DÁ¿¸Ñ¤@¤U¡A·PÁ§A!

Private Sub CommandButton1_Click()
On Error Resume Next
ph = ThisWorkbook.Path & "\"                  '¬O©â¨úÀɮתº¸ô®| + \
f = ThisWorkbook.Name                             '¬O©â¨úÀɮתº¦WºÙ

i = 1
Do Until i > Len(f) Or Not IsEmpty(n)
n = Empty
   n = CInt(Mid(f, i, 1))
   If IsEmpty(n) Then k = k & Mid(f, i, 1)
   Err.Clear
   i = i + 1
Loop                                                                '³o­Óloop¬O°w¹ïÀɦW°µ³B²z

p = Day(DateAdd("M", 1, Format(Date, "yyyy/m/1")) - 1)
                                                                          '³o­ÓP¬O?????
For j = 2 To p                                               'µæ³¾¦p§Ú¡A¥u·|¥Î j = 2 to 31    ¬°¤°»ò¥ÎP©O
fs = ph & k & j & "¤é.xls"                           '³]©wÀɦW
If Dir(fs) = "" Then ThisWorkbook.SaveCopyAs fs            '°µ¨¾§b¡A¨S¦³¦PÀɦWªº¸Ü´N·s¼W¡A¦³¦PÀɦW´N¤£·s¼W¥H§KÂл\
Next
End Sub
«¢Åo~¤j®a¦n§r

TOP

¦^´_ 7# iceandy6150
Day(DateAdd("M", 1, Format(Date, "yyyy/m/1")) - 1)
³o¥i¨ú±o³o­Ó¤ëªº¤é¼Æ
DateAdd("M", 1, Format(Date, "yyyy/m/1")) ±o¨ì¤U­Ó¤ë²Ä¤@¤Ñ¤é´Á
©Ò¥H´î1´N¬O¥»¤ë³Ì«á¤@¤Ñ
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 8# Hsieh


    ·PÁ¶W¯Åª©¥DªºÁ¿¸Ñ¡A¤SÅý¤p§Ì¾Ç²ß¤F¤£¤Ö

    ·PÁ¦A·PÁÂ!
«¢Åo~¤j®a¦n§r

TOP

        ÀR«ä¦Û¦b : ¡i®É¤é²öªÅ¹L¡j¤@­Ó¤H¦b¥@¶¡°µ¤F¦h¤Ö¨Æ¡A´Nµ¥©ó¹Ø©R¦³¦hªø¡C¦]¦¹¥²¶·»P®É¶¡Ävª§¡A¤Á²ö¨Ï®É¤éªÅ¹L¡C
ªð¦^¦Cªí ¤W¤@¥DÃD