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

[µo°Ý] ¶}±Ò¤¤ªº¤u§@ï¦X¨Ö¦Ü¥t¤@¤u§@襤

[µo°Ý] ¶}±Ò¤¤ªº¤u§@ï¦X¨Ö¦Ü¥t¤@¤u§@襤

³o¬O§Ú¿ý¤Uªº¥¨¶°¡A¨C¤ë¦³30¤ÑªºÀɮסA§Ú·Q¦b¥þ³¡¶}±Òªº±¡§Î¤U¡A¨Ï¥Î³o¼Ëªº¥¨¶°±N¯S©wªº¤u§@ªí¤À§O½Æ»s¨ì¦X¨Ö.xls¦¨¬°³æ¤@ÀɮסA¦³30­Ó¤u§@ªí¤¤
Sub Macro1()
'
' Macro1 Macro
' hsiaohsien ¦b 2011/9/19 ¿ý»sªº¥¨¶°
'

'
    Windows("0919.xls").Activate
    Sheets("²Î­p").Select
    Sheets("²Î­p").Copy After:=Workbooks("¦X¨Ö.xls").Sheets(2)
    Sheets("²Î­p").Select
    Sheets("²Î­p").Name = "0919" '<---------¤u§@ªí¦WºÙ©R¦W¥H¤u§@ïÀɦW
End Sub

Sub Macro2()
'
' Macro1 Macro
' hsiaohsien ¦b 2011/9/19 ¿ý»sªº¥¨¶°
'

'
    Windows("0918.xls").Activate
    Sheets("²Î­p").Select
    Sheets("²Î­p").Copy After:=Workbooks("¦X¨Ö.xls").Sheets(3)
    Sheets("²Î­p").Select
    Sheets("²Î­p").Name = "0918" '<---------¤u§@ªí¦WºÙ©R¦W¥H¤u§@ïÀɦW
End Sub

¦^´_ 1# hsiaohsien
  1. Sub Ex()
  2.     Dim Wb As Workbook
  3.     For Each Wb In Workbooks
  4.         If Wb.Name <> "¦X¨Ö.xls" Then   '±Æ°£ "¦X¨Ö.xls"
  5.             Wb.Sheets("²Î­p").Copy After:=Workbooks("¦X¨Ö.xls").Sheets(2)
  6.             ActiveSheet.Name = Replace(Wb.Name, ".xls", "")
  7.         End If
  8.     Next
  9.     Workbooks("¦X¨Ö.xls").Activate
  10. End Sub
½Æ»s¥N½X

TOP

Dear GBKEEª©¤j¡A

1.§Ú¸Õ¤F±zªº¤èªk¡A¦ý«o¥X²{ "°}¦C¯Á¤Þ¶W¥X½d³ò (¿ù»~ 9)"¡Aµ{¦¡½X¦p¤U¡G
Sub ²Î­p()
   Dim Wb As Workbook
   For Each Wb In Workbooks
      If Wb.Name <> "²Î­p.xls" Then   '±Æ°£ "²Î­p.xls"
         Wb.Sheets("Sheet2").Copy After:=Workbooks("²Î­p.xls").Sheets(2)   '¿ù»~9
            ActiveSheet.Name = Replace(Wb.Name, ".xls", "")
      End If
   Next
   Workbooks("²Î­p.xls").Activate
End Sub
2.§Ú¥t¥~¤S¥[¤F¸ô®|¡A¦ý«o¥X²{ "«¬ºA¤£²Å¦X (¿ù»~ 13)"¡Aµ{¦¡½X¦p¤U¡G
Sub ²Î­p()
   Dim MyBook, Wb As Workbook, MyPath As Long
   Set MyBook = ThisWorkbook
   MyPath = MyBook.Path & "\"                                        '«¬ºA¤£²Å
  With Workbooks.Open(MyPath & "*.xls")
      For Each Wb In Workbooks
         If Wb.Name <> "²Î­p.xls" Then
            Wb.Sheets("Sheet2").Copy after:=MyBook.Sheets(Sheets.Count)
            ActiveSheet.Name = Replace(Wb.Name, ".xls", "")
         End If
      Next
   End With
   Workbooks("²Î­p.xls").Activate
End Sub
3.§Ú¬O­n±N¤£¦PÀɦWªºÀɮ׶פJ¤@­ÓexcelÀɤº¡A¦A¨Ó§@¸ê®Æ³B²z¡C
waterful.tw

TOP

  1. Sub ex()
  2. Dim MyPath As String, fs As String, MySht As Worksheet
  3. MyPath = ThisWorkbook.Path & "\"
  4. fs = Dir(MyPath & "*.xls")
  5. Do Until fs = ""
  6. If fs <> ThisWorkbook.Name Then
  7.    With Workbooks.Open(fs)
  8.       Set MySht = .Sheets(2) '­n½Æ»sªº¤u§@ªí
  9.       MySht.Copy after:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
  10.       ActiveSheet.Name = Replace(fs, ".xls", "")
  11.       .Close
  12.     End With
  13. End If
  14.     fs = Dir
  15. Loop
  16. End Sub
½Æ»s¥N½X
¦^´_ 3# waterful.tw
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

ÁÂÁÂHsieh ª©¤j¡A
waterful.tw

TOP

sorry¦^´_¨ì¤@¥b¡Aµ¥§Ú¥ÎHsiehª©¤jªº¤èªk¸Õ¸Õ¡A¦³°ÝÃD ¦A¨Ó³Â·ÐÅo~
waterful.tw

TOP

¦^´_ 3# waterful.tw
Wb.Sheets("Sheet2").Copy After:=Workbooks("²Î­p.xls").Sheets(2)   '¿ù»~9 ->¨S¦³2 , ·|¦³1  §A¥Î Sheets.Count´À¥N¤]¦æ

Dim   MyPath As Long          '  -> ¼Æ¦r  Long (ªø¾ã¼Æ)ÅܼƫY¥H½d³ò±q -2,147,483,648 ¨ì 2,147,483,647 ¤§ 32 ¦ì¤¸ (4 ­Ó¦ì¤¸²Õ) ¦³¸¹¼Æ¦r§Î¦¡Àx¦s¡C
Set MyBook = ThisWorkbook  
MyPath = MyBook.Path & "\"                                    '·íµM¬O«¬ºA¤£²Å
Dim MyPath As String  ->À³­×§ïºû¦r¤¸
'String¤§¦r¤¸½Xªº½d³ò±q 0 ¨ì 255¡C¦r¤¸¶°ªº«e 128 ­Ó¦r¤¸ ( 0 ¨ì 127 ) ¹ïÀ³©ó¼Ð·Çªº U.S Áä½L¤Wªº¦r¤¸»P²Å¸¹

TOP

Dear Hsieh & GBKEEª©¤j¡A
§Ú¤w½Æ»s±zªºµ{¦¡¡A¨Ã­×§ïMyPathªº«¬ºA¬°String¡Aµ²ªG²{¦b¬O¦bwith¨º¦æ¥X²{°õ¦æ¶¥¬q¿ù»~'1004'=>§ä¤£¨ìÀɮשÎÀɦW¿ù»~¡I
©_©Çªº¬O¡A"C:\Documents and Settings\Administrator\®à­±\try and error\*.xls"¤£¬O¹q¸£¦Û¤v§ìªº? ÀɦW"*.xls"À³¸Ó¤]¨S¿ùªü? ·Pı¶V¨Ó¶V¶Ã¤F...orz
waterful.tw

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-10-3 17:16 ½s¿è

¦^´_ 8# waterful.tw
MyPath = ThisWorkbook.Path & "\"
fs = Dir(MyPath & "*.xls")  


½Ð¥[¤W  ChDir  MyPath      §ïÅܥثeªº¥Ø¿ý  ¨Ó­×¥¿¿ù»~

¦p¥Ø«eªº¥Ø¿ý©ÎÀɮק¨¦b   ThisWorkbook.Path & "\"   
With Workbooks.Open(fs)   ->    ¶}±Ò¥Ø«eªº¥Ø¿ý¤UÀÉ®×fs  ©Ò¥H¤£·|¦³¿ù»~.
¦p¥Ø¿ý©ÎÀɮק¨¤£¦b   ThisWorkbook.Path & "\"   
¤]¥i­×¥¿¬°   With Workbooks.Open(MyPath & fs)     ->¦p :   d:\test\ fs
¥HÁקK ¥Ø«eªº¥Ø¿ý©ÎÀɮק¨¤£¬O¦b  ThisWorkbook.Path   ->   With Workbooks.Open(fs) ·|²£¥Í¿ù»~

¥i¥Î MsgBox  CurDir  ¬d¬Ý¥Ø«eªº¥Ø¿ý©ÎÀɮק¨
CurDir¨ç¼Æ  ->¶Ç¦^¤@­Ó Variant (String)¡A¥Î¨Ó¥Nªí¥Ø«eªº¸ô®|¡C
Excel ¶}±Ò®É·|¨Ì ¦p¹Ï³]¥ß¥Ø«eªº¥Ø¿ý©ÎÀɮק¨


TOP

¦^´_ 9# GBKEE

    ÁÂÁÂGBKEEª©¤j¡A§Ú«á¨Óµo²{¡A¥i¯à¬O§Ú­n¦X¨Öªº¤u§@ï®æ¦¡¤Ó¹L½ÆÂø(¥Ñ.csvÀɶ]¹L¥¨¶°¡A¦b¥t¦s¬°.xlsÀÉ)¡AEXCEL°O¾ÐÅé­t²ü¤£¤F¡A©Ò¥H¤~·|¤@­È¶]¥X'1004'°õ¦æ¶¥¬q¿ù»~¡I«á¨Ó§Ú§ï¬°¥ý±NcsvÀɸê®Æ¦X¨Ö¨ìexcel¤u§@­¶¡A¦b¥Î¥¨¶°°µ¸ê®Æ³B²z¡A´NOK¤F¡I¤£¹LÁÙ¬OÁÂÁª©¤j¡AÅý§Ú¤S¾Ç¨ì¤@©Û¤F¡I
waterful.tw

TOP

        ÀR«ä¦Û¦b : ¯¸¦b¥b¸ô¡A¤ñ¨«¨ì¥Ø¼Ð§ó¨¯­W¡C
ªð¦^¦Cªí ¤W¤@¥DÃD