Public Sub GatherDataPicker()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlCalculationManual
Application.StatusBar = ">>>>>>>>程序正在运行>>>>>>>>" On Error GoTo ErrHandler Dim StartTime, UsedTime As Variant
StartTime = VBA.Timer Dim wb As Workbook
Dim Sht As Worksheet
Dim OpenWb As Workbook
Dim OpenSht As Worksheet
Const SHEET_INDEX = 1
Const HEAD_ROW As Long = 3 Dim FolderPath As String
Dim FileName As String
Dim FileCount As Long
Dim iRow As Long With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = ThisWorkbook.Path
.AllowMultiSelect = False
.Title = "请选取Excel工作簿所在文件夹"
If .Show = -1 Then
FolderPath = .SelectedItems(1)
Else
MsgBox "您没有选中任何文件夹,本次汇总中断!"
Exit Sub
End If
End With
If 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 = 0
FileName = Dir(FolderPath & "*.xls*")
Do While FileName <> ""
If FileName <> ThisWorkbook.Name Then
FileCount = FileCount + 1
Set OpenWb = Application.Workbooks.Open(FolderPath & FileName)
With OpenWb
Set OpenSht = OpenWb.Worksheets(SHEET_INDEX) iRow = FileCount + HEAD_ROW
With OpenSht
Sht.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 '90
Sht.Cells(iRow, 14).Value = .Range("G31").Value '90以后
End With
.Close False
End With
End If
FileName = Dir
Loop
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
UsedTime = VBA.Timer - StartTime
MsgBox "本次耗时:" & Format(UsedTime, "0.000秒"), vbOKOnly, "Excel Studio " ErrorExit:
Set wb = Nothing
Set Sht = Nothing
Set OpenWb = Nothing
Set OpenSht = Nothing
Set Rng = Nothing Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.Calculation = xlCalculationAutomatic
Application.StatusBar = False
Exit Sub
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ErrHandler:
If Err.Number <> 0 Then
MsgBox Err.Description & "!", vbCritical, "Excel Studio "
'Debug.Print Err.Description
Err.Clear
Resume ErrorExit
End If
End Sub

  

20170706xlVBA城中村改造汇总的更多相关文章

  1. MySQL建表、插入语句等

    不定时更新MySQL的一些基础语句以及出现过的问题 5.10 建表语句 CREATE TABLE `policy_landvalue` ( `id` ) NOT NULL AUTO_INCREMENT ...

  2. jq瀑布流代码

    <style> #zh{ position:fixed; width:100%; height:100%; background:url(images/bgblack.png); top: ...

  3. A9系统时钟用外部

     问个笨蛋的问题,,电脑主板的主频是由外部时钟倍频得来,还是内部时钟倍频?? [ARM11]瘋子 2015/5/5 19:08:16 @蓝凌风 [x86]蓝凌 2015/5/5 19:08:25 外部 ...

  4. 等方案及设备提供商 有需要的可以联系QQ561454825,电话:13779953060,我们提供最专业的无线WIFI认证系统及根据您的需要修改软件

    WayOs智能路由.EasyRadius云计费.POE远程供电.WIFI城中村方案.EPON实现FTTB+LAN城中村方案. 等方案及设备提供商 有需要的可以联系QQ561454825,电话:,我们提 ...

  5. "逃离北京"的这些年 2

    一  找工作第二阶段 我为了保险,在辞职信还特别写了:特此提前一个月提出辞职. 果然是搞金融的,C公司在我提交辞职信后,一周内就让我整理好工作资料,办好辞职手续. 没关系,都是要走的人.早点离开也是好 ...

  6. 这个月干啥去了?——H5+移动应用实战开发

    又到了公司一年当中最忙的时刻了,为了赶项目,现在居然开启了996模式,这是我从事.net开发以来从来没遇到过的. 一转眼,一个月又过了,回头一看,这个月一篇文章都没有发,上个月忙着一个人做项目,项目忙 ...

  7. hive常用操作

    相关显示参数设置 显示参数设置 set hive.cli.print.header=true; // 打印列名 set hive.cli.print.row.to.vertical=true; // ...

  8. 利用Kettle 从Excel中抽取数据写入SQLite

    SQLite作为一种数据库可以配置为Kettle的数据输入和输出,这个例子是从Excel中抽取数据然后写入到SQLite中 配置测试并成功后如下 下面是配置步骤: Excel输入配置 sqlite配置 ...

  9. 为什么WAN口IP和外网IP不一样(不一致)?

    正常的网络应该是动态公网ip,也就是路由器里面的WAN口IP与www.ip138.com上面显示的是一致的,不一致的话则说明该网络被电信或者联通做了NAT转发,导致您获取到了一个虚假的IP地址,无法用 ...

随机推荐

  1. FastDFS+nginx+keepalived集群搭建

    安装环境 nginx-1.6.2 libfastcommon-master.zip FastDFS_v5.05.tar.gz(http://sourceforge.net/projects/fastd ...

  2. iOS xcode创建静态库封装自己的SDK及使用

    https://www.cnblogs.com/JustForHappy/p/5773039.html 一,静态库和动态库的区别在这里就不说了,个人感觉如果是自己封装提供别人下载的话应该是静态库比较方 ...

  3. Elasticsearch 疑难解惑

    Elasticsearch是如何实现Master选举的? Elasticsearch的选主是ZenDiscovery模块负责的,主要包含Ping(节点之间通过这个RPC来发现彼此)和Unicast(单 ...

  4. VM三种网络连接方式

    bridge:这种方式最简单,直接将虚拟网卡桥接到一个物理网卡上面,和Linux下一个网卡 绑定两个不同地址类似,实际上是将网卡设置为混杂模式,从而达到侦听多个IP的能力. 在此种模式下,虚拟机内部的 ...

  5. SCP报错:WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

    经过google,出现这个问题的原因是,这是ssh的问题, GkFool大神说(第一次使用SSH连接时,会生成一个认证,储存在客户端的known_hosts中) 我的解决办法是: ssh-keygen ...

  6. CentOS 7 怎样自动连接网络

    https://jingyan.baidu.com/article/19192ad8f7c320e53e570728.html

  7. CEF之CefSettings设置日志等级

    CefSettings结构体允许定义全局的CEF配置,经常用到的配置项如下: single_process 设置为true时,Browser和Renderer使用一个进程.此项也可以通过命令行参数“s ...

  8. 本地连接VM virtualBox ubuntu16.04 中的Mysql数据库

    1.打开mysql配置文件vim /etc/mysql/mysql.conf.d/mysqld.cnf     将bind-address = 127.0.0.1注销 2.重启ubuntu数据库 3. ...

  9. linux下安装微信小程序开发工具

    一.环境:: ubuntu 16.04 二.安装过程: 2.1 安装wine sudo apt-get install wine 2.2 安装nwjs-sdk 2.2.1 下载linux版nwjs-s ...

  10. 51NOD 1099 任务执行顺序

    来源:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1099 前天没睡好 昨天做题闷闷沉沉的 好多一眼题 都瞎做了 这题今 ...