欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
Excel中快速合并一個(gè)文件夾下多個(gè)工作簿中的所有工作表VBA代碼

插入—模塊 復制如下代碼

Dim x As Integer '定義個(gè)一公有變量記錄復制行數

'復制多個(gè)Excel文件中的內容到一個(gè)里

Sub combine()

x = 1

Dim folder As String

Dim count As Integer

folder = ChooseFolder()

'count = combineFiles(folder, 'xls')

count = count + combineFiles(folder, 'xlsx')

MsgBox (' succeed ')

End Sub

Function combineFiles(folder, appendix)

Dim MyFile As String

Dim s As String

Dim count, n, copiedlines As Integer

MyFile = Dir(folder & '\*.' & appendix)

count = count + 1

n = 2

Do While MyFile <> ''

copiedlines = CopyFile(folder & '\' & MyFile, 2, n)

If copiedlines > 0 Then

n = n + copiedlines

count = count + 1

End If

MyFile = Dir

Loop

combineFiles = count

End Function

'復制數據

Function CopyFile(filename, srcStartLine, dstStartLine)

Dim book As Workbook

Dim sheet As Worksheet

Dim rc As Integer

CopyFile = 0

If filename = (ThisWorkbook.Path & '\' & ThisWorkbook.Name) Then

Exit Function

End If

Set book = Workbooks.Open(filename)

ThisWorkbook.Activate

For j = 1 To book.Sheets.count

book.Sheets(j).UsedRange.Copy Cells(x, 1)

With ActiveSheet.Cells.Find('*', Cells(1, 1), -4163, 1, 1, 2).MergeArea '通用判斷最后一行

Rows(.Row + .Rows.count - 1).Select

x = Selection.Row + Selection.Rows.count - 1

End With

x = x + 1

Next j

book.Close

End Function

'選擇文件夾

Function ChooseFolder() As String

Dim dlgOpen As FileDialog

Set dlgOpen = Application.FileDialog(msoFileDialogFolderPicker)

With dlgOpen

If .Show = -1 Then

ChooseFolder = .SelectedItems(1)

End If

End With

Set dlgOpen = Nothing

End Function

點(diǎn)擊下方了解更多看視頻解析

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
VBA--遍歷文件夾下所有文件--模板
VBA遍歷多級文件夾對文件中的內容進(jìn)行查詢(xún)(dir循環(huán)遍歷)
Excel VBA 遍歷*.xlsx文件的方法
批量合并Excel數據時(shí)“外部表不是預期格式”或“文件包含損壞數據”的兩種情況
VBA實(shí)用小程序70:獲取壓縮文件中指定文件的修改日期
VBA文件及文件夾操作
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久