日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

20170706xlVBA城中村改造汇总

發布時間:2023/12/20 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 20170706xlVBA城中村改造汇总 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Public Sub GatherDataPicker()Application.ScreenUpdating = FalseApplication.DisplayAlerts = FalseApplication.Calculation = xlCalculationManualApplication.StatusBar = ">>>>>>>>程序正在運行>>>>>>>>"On Error GoTo ErrHandlerDim StartTime, UsedTime As VariantStartTime = VBA.TimerDim wb As WorkbookDim Sht As WorksheetDim OpenWb As WorkbookDim OpenSht As WorksheetConst SHEET_INDEX = 1Const HEAD_ROW As Long = 3Dim FolderPath As StringDim FileName As StringDim FileCount As LongDim iRow As LongWith Application.FileDialog(msoFileDialogFolderPicker).InitialFileName = ThisWorkbook.Path.AllowMultiSelect = False.Title = "請選取Excel工作簿所在文件夾"If .Show = -1 ThenFolderPath = .SelectedItems(1)ElseMsgBox "您沒有選中任何文件夾,本次匯總中斷!"Exit SubEnd IfEnd WithIf Right(FolderPath, 1) <> "\" Then FolderPath = FolderPath & "\"Set wb = Application.ThisWorkbook '工作簿級別Set Sht = wb.Worksheets("匯總表")Application.Intersect(Sht.UsedRange.Offset(HEAD_ROW), Sht.Range("A:O")).ClearContents'FolderPath = ThisWorkbook.Path & "\"FileCount = 0FileName = Dir(FolderPath & "*.xls*")Do While FileName <> ""If FileName <> ThisWorkbook.Name ThenFileCount = FileCount + 1Set OpenWb = Application.Workbooks.Open(FolderPath & FileName)With OpenWbSet OpenSht = OpenWb.Worksheets(SHEET_INDEX)iRow = FileCount + HEAD_ROWWith OpenShtSht.Cells(iRow, 1).Value = .Range("C4").Value '檔案號Sht.Cells(iRow, 2).Value = .Range("C3").Value '姓名Sht.Cells(iRow, 3).Value = .Range("G3").Value '地址Sht.Cells(iRow, 4).Value = .Range("H31").Value '總面積Sht.Cells(iRow, 5).Value = .Range("B31").Value '產權Sht.Cells(iRow, 6).Value = .Range("C31").Value '規劃Sht.Cells(iRow, 10).Value = .Range("E31").Value '90Sht.Cells(iRow, 14).Value = .Range("G31").Value '90以后End With.Close FalseEnd WithEnd IfFileName = DirLoop'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>UsedTime = VBA.Timer - StartTimeMsgBox "本次耗時:" & Format(UsedTime, "0.000秒"), vbOKOnly, "Excel Studio "ErrorExit:Set wb = NothingSet Sht = NothingSet OpenWb = NothingSet OpenSht = NothingSet Rng = NothingApplication.ScreenUpdating = TrueApplication.DisplayAlerts = TrueApplication.Calculation = xlCalculationAutomaticApplication.StatusBar = FalseExit Sub'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ErrHandler:If Err.Number <> 0 ThenMsgBox Err.Description & "!", vbCritical, "Excel Studio "'Debug.Print Err.DescriptionErr.ClearResume ErrorExitEnd If End Sub

  

轉載于:https://www.cnblogs.com/nextseven/p/7128179.html

總結

以上是生活随笔為你收集整理的20170706xlVBA城中村改造汇总的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。