功能描述:
一个Excel文件有很多个 样式相同 的数据表,
需要将多张数据表的内容合并到一张数据表里。
vba实现代码如下:
Attribute VB_Name = "NewMacros"
Option Explicit
Public Const Const_OutSheetName As String = "VBA汇总"
Public Const Const_PZSheetName As String = "配置"
Sub 汇总()
Attribute 汇总.VB_Description = "宏由 LiuZW 录制,时间: 2023/08/19"
Attribute 汇总.VB_ProcData.VB_Invoke_Func = " 14"
'
' 汇总 Macro
' 宏由 LiuZW 录制,时间: 2023/08/19
'
'
Dim i, j, k As Integer
'创建“配置”数据表并提示用户填写配置
Dim isExistPZ As Boolean
isExistPZ = False
For i = 1 To Worksheets.Count
If Worksheets(i).name = Const_PZSheetName Then
isExistPZ = True
Exit For
End If
Next
'定义表示要复制的区域的变量
Dim mRow1, mColumn1, mRow2, mColumn2 As Integer
If isExistPZ Then
mRow1 = Application