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

¦X¨Ö¤@­Óexcel¤ºªº´X­Óworksheetªº¤º®e¦b¥t¤@­Óexcel¤ºªº¤@­Óworksheet¤º

¦X¨Ö¤@­Óexcel¤ºªº´X­Óworksheetªº¤º®e¦b¥t¤@­Óexcel¤ºªº¤@­Óworksheet¤º

¦X¨Ö3­ÓEXCEL.rar (18.97 KB)
Private Sub cmdMerge_Click()
    Dim a, b, c As Integer '«Å§iA,B,C¬°¾ã¼Æ
    Dim objsheet As Worksheet
   
    Source = Excel.ActiveWorkbook.Name '·sÀÉ®×µøµ¡½s¸¹   
   
    n = Range("b3")
    m = Range("b4")
   
    hmerger = UCase(Range("b5")) '¬O§_¬°¤ô¥­¦X¨Ö   
     '±N¤§«e¦X¨Öªºµ²ªG²M°£
    Sheet2.Range("A:AB").Clear
   
    z = 1
    i = 1
   
    Filename1 = Range("b" & 6) & "." & Range("b2")
    Filename2 = Range("b" & 7) & "." & Range("b2")
    Filename3 = Range("b" & 8) & "." & Range("b2")
   
    Workbooks.Open Filename:=Excel.Workbooks(Source).Path & "\" & Filename1
    Workbooks.Open Filename:=Excel.Workbooks(Source).Path & "\" & Filename2
    Workbooks.Open Filename:=Excel.Workbooks(Source).Path & "\" & Filename3
   
    WorkName = Excel.ActiveWorkbook.Name '

¦^´_ 1# 198188
  1. Private Sub cmdMerge_Click()
  2. Dim wb As Workbook, msh As Worksheet, mxsh As Worksheet, fs As String, sh, Tr As Range
  3. Application.ScreenUpdating = False
  4. fd = ThisWorkbook.Path & "\" 'Àɮץؿý"
  5. Set msh = ThisWorkbook.Sheets("°Ñ¼Æ³]©w")
  6. Set mxsh = ThisWorkbook.Sheets("¦X¨Öµ²ªG")
  7. fs = fd & msh.[B1] & "." & msh.[B2]
  8. If Dir(fs) = "" Then MsgBox "Àɮץؿý¿ù»~½ÐÀˬd": Exit Sub
  9. mxsh.Cells.Clear
  10. Set wb = Workbooks.Open(fs)
  11.   For Each sh In msh.Range(msh.[B6], msh.[B6].End(xlDown))
  12.      With wb.Sheets(CStr(sh))
  13.      If Tr Is Nothing Then Set Tr = .Range(.[A1], .[A1].End(xlToRight)): Tr.Copy mxsh.[A1]
  14.         .Range("A1").CurrentRegion.Offset(msh.[B4], msh.[B3] - 1).Copy mxsh.[A65536].End(xlUp).Offset(1)
  15.      End With
  16.   Next
  17. wb.Close 0
  18. MsgBox "¦X¨Ö§¹¦¨"
  19. Application.ScreenUpdating = True
  20. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# Hsieh


    ½Ð°Ý¦pªG±N´X­Ó¤£¦Pªºexcel¦X¨Ö¥i¥H¶Ü¡H³o­Ó¥u¬O±N¤@­Óexcelªº¤£¦Pworksheet¦X¨Ö¡C¦ý¤£¦Pªºexcel§Ú´N·Q¤£¨ì¡A«ç¼Ë¸Ñ¨M¡H

TOP

¦^´_ 3# 198188


    workbooks.open¥D­n¬Ofilename¤Þ¼Æªº¨ú±o
filename¬O¬¡­¶Ã¯ªº¸ô®|¥]§tÀɮצWºÙ©Ò²Õ¦¨ªº¦r¦ê
·Q·Q¦p¦ó±o¨ì¦¹¦r¦ê¬O¸Ñ¨M°ÝÃDªº®Ú¥»
½×¾Â¤¤¦¹Ãþ¤å³¹¬Æ¦h¥i¥H°Ñ¦Ò
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : °ß¨ä´L­«¦Û¤vªº¤H¡A¤~§ó«i©óÁY¤p¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD