书上的代码:
Sub HzwWb()
Dim r As Long, c As Long
r = 1
c = 63
Range(Cells(r + 1, "A"), Cells(65536, c)).ClearContents
Application.ScreenUpdating = False
Dim FileName As String, wb As Workbook, sht As Worksheet, Erow As Long, fn As String, arr As Variant
FileName = Dir(ThisWorkbook.Path & "\*.xls")
Do While FileName <> ""
If FileName <> ThisWorkbook.Name Then
Erow = Range("A1").CurrentRegion.Rows.Count + 1
fn = ThisWorkbook.Path & "\" & FileName
Set wb = GetObject(fn)
Set sht = wb.Worksheets(1)
arr = sht.Range(sht.Cells(r + 1, "a"), sht.Cells(65536, "b").End(xlUp).Offset(0, 63))
Cells(Erow, "A").Resize(UBound(arr, 1), UBound(arr, 2)) = arr
wb.Close False
End If
FileName = Dir
Loop
Application.ScreenUpdating = True
End Sub
可以将同一个文件夹下多工作簿数据汇总到一个工作簿,但是原始工作簿的表格有一些这样的格式:
例如时间、身份证号,
汇总到新的工作簿后,数据变成了这个样子:
数据被自动截取了一部分,时间格式没有秒了,这种情况哪位专家帮忙给解决下??
|