|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
不明白这个语句的意思及“\”这个是什么作用。
全部语句如下:
Sub HzWb()
Dim bt As Range, r As Long, c As Long
r = 1 '1 ??????????
c = 8 '8 ??????????
Range(Cells(r + 1, "A"), Cells(65536, c)).ClearContents ' ?????????????????
Application.ScreenUpdating = False
Dim filename As String, wb As Workbook, 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) ' ??fn ????????????????????
Set sht = wb.Worksheets(1) ' ????????1 ???????
' ????????е?????????arr ??????
arr = sht.Range(sht.Cells(r + 1, "A"), sht.Cells(65536, "B").End(xlUp).Offset(0, 8))
' ??????arr ?е?????д??????
Cells(erow, "A").Resize(UBound(arr, 1), UBound(arr, 2)) = arr
wb.Close False
End If
filename = Dir ' ??Dir ????????????????????????????
Loop
Application.ScreenUpdating = True
End Sub |
|