牽涉格式及合併格, 用VBA吧~~
Sub 更新()
Dim Sht As Worksheet, R&, xE As Range, CL, N%
Call 清除
CL = Array(36, 35) '顏色
For Each Sht In Sheets
If Sht.Name Like "#######-#*" = False Then GoTo 101 '判斷工作表名稱是否符合 "年月日-序號"
R = Sht.Cells(Rows.Count, "D").End(xlUp).Row - 5
If R <= 0 Then GoTo 101
Set xE = Sheets("總表").Cells(Rows.Count, 1).End(xlUp)(2)
Sht.Range("A6:G6").Resize(R - 1).Copy xE(1, 2)
Sht.Range("A6").Resize(R - 1).Copy xE
xE.Resize(R - 1) = Sht.Name
N = 1 - N
xE.Resize(R - 1, 8).Interior.ColorIndex = CL(N) '以顏色區分各工作表資料(若用不到可刪)
101: Next
End Sub
Sub 清除()
Sheets("總表").UsedRange.Offset(1, 0).EntireRow.Delete
End Sub
Sub 更新()
Dim Sht As Worksheet, R&, xE As Range, CL, N%
Call 清除
CL = Array(36, 35) '顏色
For Each Sht In Sheets
If Sht.Name Like "#######-#*" = False Then GoTo 101 '判斷工作表名稱是否符合 "年月日-序號"
R = Sht.Cells(Rows.Count, "D").End(xlUp).Row - 5
If R <= 0 Then GoTo 101
Set xE = Sheets("總表").Cells(Rows.Count, 1).End(xlUp)(2)
Sht.Range("A5:N5").Resize(R - 1).Copy xE(1, 2)
Sht.Range("A5").Resize(R - 1).Copy xE
xE.Resize(R - 1) = Sht.Name
N = 1 - N
xE.Resize(R - 1, 8).Interior.ColorIndex = CL(N) '以顏色區分各工作表資料(若用不到可刪)
101: Next
End Sub
Sub 清除()
Sheets("總表").UsedRange.Offset(1, 0).EntireRow.Delete
End Sub