日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

excel文件打開亂碼 excel文件打不開( 二 )


    Dim fileCount As Integer, maxRow As Integer
    Dim iRow As Integer, iCol As Integer
    Dim sFile As String
    
    Set ws = ThisWorkbook.Sheets(1)
    Dim sht As Worksheet
    
    '清空歷史內容,防重復
    ws.Cells.ClearContents
    Application.ScreenUpdating = False
    If sPath <> "" Then
        sPath = sPath & "\\"
        sFile = Dir(sPath & "*.xls?")
        Do While Len(sFile) > 0
            fileCount = fileCount + 1
            Set wb = Workbooks.Open(sPath & sFile)
            Set sht = wb.Sheets(1)
            '數據的行列數
            With sht.Range("a1").CurrentRegion
                iRow = .Rows.Count
                iCol = .Columns.Count
            End With
            
            If ws.Range("a1") = "" Then '第一次粘貼
                ws.Range("a1").Resize(iRow, iCol).Value = https://atx106.com/_
                sht.Range("a1").CurrentRegion.Value
            Else
                maxRow = ws.Cells(Rows.Count, 1).End(3).Row + 1
                ws.Cells(maxRow, 1).Resize(iRow – 1, iCol).Value = https://atx106.com/_
                sht.Range("a2").Resize(iRow – 1, iCol).Value
            End If
            wb.Close 0
            sFile = Dir
        Loop
    End If
    Application.ScreenUpdating = True
    MsgBox "合并完成,共合并" & fileCount & "個文件", vbOKOnly, "提示"
End Sub
說完VBA,我們最后再來說一下,Power Query如何實現匯總,我知道很多新手朋友都是一步一步操作,這里我們就直接使用M函數來寫,所謂的函數式編程:

excel文件打開亂碼 excel文件打不開


Excel辦公實戰(zhàn) 一起學習Excel,0基礎、進階、高級圖文動畫教程!技巧,函數,技巧,VBA,可視化圖表,PBI!視頻教程、免費模板、精英培訓!VLOOKUP系列教程! 1107篇原創(chuàng)內容
▲1000+精心原創(chuàng),您有問題,這里有方案

推薦閱讀