2024年-ExcelVBA多工作簿多工作表实例集锦_第1页
2024年-ExcelVBA多工作簿多工作表实例集锦_第2页
2024年-ExcelVBA多工作簿多工作表实例集锦_第3页
2024年-ExcelVBA多工作簿多工作表实例集锦_第4页
2024年-ExcelVBA多工作簿多工作表实例集锦_第5页
已阅读5页,还剩88页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1,多工作表汇总(Consolidate)

'http:〃www.excelpx.com/dispbbs.asp?boardID=5&ID=l10630&page=l

'两种写法都要求地址用R1C1形式,各个表格的数据布置有规定。

SubConsolidateWorkbook()

DimRangcArray()AsString

DimbkAsWorksheet

DimshtAsWorksheet

DimWbCountAsInteger

Setbk=Sheets("汇总")

WbCount=Sheets.Count

ReDimRangeArray(1ToWbCount-1)

ForEachshtInSheets

Ifsht.Name<>"汇总"Then

i=i+1

RangeArray(i)=&sht.Name

sht.Range("Al").CurrentRegion.Address(ReferenceStyle:=xlRIC1)

EndIf

Next

bk.Range(z,Al,z).ConsolidateRangeArray,xlSum,True,True

[al].Value="姓名"

EndSub

Subsumdemo()

DimarrAsVariant

arr=Array("一月!R1C1:R8c5”,〃二月!R1C1:R5c4”,〃三月!RIC1:R9c6”)

WithWorksheets("汇总”).Range("Al")

.Consolidatearr,xlSum,True,True

.Value=〃姓名〃

EndWith

EndSub

2,多工作簿汇总(Consolidate)

'多工作簿汇总

SubConsolidatcWorkbook()

DimRangeArray()AsSiring

DimbkAsWorkbook

DimshtAsWorksheet

DimWbCountAsInteger

WbCount=Workbooks.Count

ReDimRangeArray(1ToWbCount-1)

ForEachbkInWorkbooks'在所有工作簿中循环

IfNotbkIsThisWorkbookThen'非代码所在工作簿

Setsht=bk.Worksheets。)'引用工作簿的第一个工作表

i=i+1

RangeArray(i)="'["&bk.Name&&sht.Name&&

sht.Range("Al").CurrentRegion.Address(ReferenceStyle:=xlRlCl)

EndIf

Next

Worksheets(1).Range("Al〃).Consolidate_

RangeArray,xlSum,True,True

EndSub

3,多工作簿汇总(FileSearch)

'http:〃club,excelhome,net/thread-442007-1-1,html###

,help\汇总表.xls

Subpldrwb0531()

'汇总表.xls

'导入指定文件的数据

DimmyFsAsFi1eSearch

DimmyPathAsString,Filenames

DimiAsLong,nAsLong

DimShtlAsWorksheet,shAsWorksheet

Dimaa,nm$,nml$,m,arr,rl,coll%

Application.ScreenUpdating=False

SetShtl=ActiveSheet

SetmyFs=Application.Fi1eSearch

myPath=ThisWorkbook.Path

WithmyFs

.NewSearch

.LookIn=myPath

.FileType=msoFileTypeNoteltem

.Filename=xls”

If.Execute(SortBy:-msoSortByFileName)>0Then

n=.FoundFiles.Count

col1=2

ReDimmyfile(1Ton)AsSti'ing

Fori=1Ton

myfile(i)=.FoundFiles(i)

Filename=myfile(i)

aa=InStrRev(Filename,"\")

nm=Right(Filename,Len(Filename)-aa)

nml=Left(nm,Len(nm)-4)

Ifnml<>"汇总表"Then

Workbooks.Openmyfile(i)

DimwbAsWorkbook

Setwb=ActiveWorkbook

m=[a65536].End(x1Up).Row

arr=Range(Cells(3,3),Cells(m,3))

Shtl.Activate

coll=coll+1

Cells(2,coll)=nm'自动获取文件名

Cells(3,coll).Resize(UBound(arr),1)=arr

wb.Closesavechanges:=False

Setwb=Nothing

EndIf

Next

Else

MsgBox"该文件夹里没有任何文件”

EndIf

EndWith

[al].Select

SetmyFs=Nothing

Application.ScreenUpdating=True

EndSub

'根据上例增加了在一个工作簿中可选择多个工作表进行汇总,运用了文本框多选功能

Pub1icar,arl,nm$

Subpldrwb0531()

'汇总表.xls

'导入指定文件的数据(默认工作表1的数据)

'直接从C列依次导入

DimmyFsAsFileSearch

DimmyPathAsString,Filenames

DimiAsLong,nAsLong

DimShtlAsWorksheet,shAsWorksheet

Dimaa,nml$,m,arr,rl,coll%

Application.ScreenUpdating=False

OnErrorResumeNext

SetShtl=ActiveSheet

SetmyFs=Application.FileSearch

myPalh=ThisWorkbook.Path

WithmyFs

.NewSearch

.LookIn=myPath

.FileTypo=msoFileTypcNoteltem

.Filename=〃*.xls”

If.Execute(SortBy:=msoSortByFi1eName)>0Then

n=.FoundFiles.Count

col1=2

ReDimmyfile(1Ton)AsString

Fori=1Ton

myfile(i)=.FoundFiles(i)

Filename=myfile(i)

aa=InStrRev(Filename,"\")

nm=Right(Filename,Len(Fi1ename)-aa)

nml=Left(nm,Len(nm)-4)

Ifnml<>"汇总表"Then

Workbooks.Openmyfile(i)

DinwbAsWorkbook

Setwb=ActiveWorkbook

ForEachshInSheets

s=s&sh.Name&”

Next

s=Left(s>Len(s)-1)

ar=Split(s,

UserForml.Show

Forj=0ToUBound(arl)

IfErr.Number=9ThenGoTo100

Setsh=wb.Sheets(arl(j))

sh.Activate

m=sh.[a65536].End(xlUp).Row

arr=Range(Cells(3,3),CelIs(m,3))

Shtl.Activate

coll=coll+1

Cells(2,col1)=sh.[al]

Cells(3,colD.FormulaRlCl=&nm&丁&arl(j)

&”!RC3〃'显示引用的工作簿工作表及单元格地址

Cel1s(3,coll).AutoFil1Range(CelIs(3,cell),

Cells(UBound(arr)+2,coll))

*Cells(3,coll).Resize(UBound(arr),1)=arr

Nextj

100:wb.Closesavechanges:=False

Setwb=Nothing

IfVarType(arl)=8200ThenErasearl

EndIf

Next

Else

MsgBox〃该文件夹里没有任何文件”

EndIf

EndWith

[al].Select

SetmyFs=Nothing

Application.ScreenUpdating=True

EndSub

PrivateSubCommandButtonlClick()

Fori=0ToListBoxl.ListCount-1

IfListBoxl.Selected(i)=TrueThen

s=s&ListBoxl.List(i)&”,〃

EndIf

Nexti

Ifs<>""Then

s=Left(s,Len(s)-1)

arl=Split(s,

MsgBox"你选择了"&s

UnloadUserForml

Else

mg=MsgBox(“你没有选择任何工作表!需要重新选择吗?",vbYesNo,"提示")

Ifmg=6Then

Else

UnloadUserForml

EnclIf

EndIf

EndSub

PrivateSubCommandButton2Click()

UnloadUserForml

EndSub

PrivateSubUserFoi-mInitializeO

WithMe.ListBoxl

.List=ar'文本框赋值

.ListStyle=1'文本前加选择小方框

.MultiSelect=1'设置可多选

EnclWith

Me.Label1.Caption=Me.Label1.Caption&nm

EnclSub

4,多工作表汇总(字典、数组)

'htlp:〃club,excelhome.net/viewthread.php?tid=450709&pid=2928374&page=l&extra=

page%3Dl

4Data多表汇总0623.xls

Subdbhz()

'多表汇总

DimShtlAsWorksheet,Sht2AsWorksheet,ShtAsWorksheet

Dimd,k,t,Myr&,Arr.x

Application.ScreenUpdating=False

Application.DisplayAlerts=False

Setd=CrealeObject("Scripting.Dictionary")

ForEachShtInSheets'删除同名的表格,获得要增加的汇总表格不重复名字

IfInStr(Sht.Name,"-")>0ThenSht.Delete:GoTo100

nm=Mid(Sht.[a3],7)

d(nm)=""

100:

NextSht

Application.DisplayAlerts=True

k=d.keys

Fori=0ToUBound(k)

Sheets.Addafter:=Sheets(Sheets.Count)

SetShtl=ActiveSheet

Shtl.Name=Replace(k(i),〃/",f'增加汇总表,把名字中的"/"(不能用

作表名的)改为"-“

Nexti

Erasek

Setd=Nothing

ForEachShtInSheets

WithSht

.Activate

IfInStr(.Name.=0Then

nm=Replace(Mid(.[a3],7),7",

Myr=.[h65536].End(xlUp).Row

Arr=.Range("d1():h"&Myr)

Setd=CreateObject(''Scripting.Dictionary^)

Fori=1ToUBound(Arr)

x=Arr(i,1)

IfNotd.exists(x)Then

d.Addx,Arr(i,5)

Else

d(x)=d(x)+Arr(i,5)

EndIf

Next

k=d.keys

t=d.items

SetSht2=Sheets(nm)

Sht2.Activate

myr2=[a65536].Bnd(x1Up).Row+1

Ifmyr2<9Then

Cells(9,1).Resized,2)=Array「PartNo.","TTLQty")

Cells(10,1).Resize(UBound(k)+1,1)=Appliceition.Transpose(k)

Cells(10,2).Resize(UBound(t)+1,1)=Application.Transpose(t)

Else

Cells(myr2,1).Resize(UBound(k)+1,1)=Application.Transpose(k)

Cells(myr2,2).Resize(UBound(t)(1,1)=Application.Transpose(t)

EndIf

Erasek

Eraset

Setd=Nothing

EndIf

EndWith

NextSht

Application.ScreenUpdating=True

EndSub

5,多工作簿提取指定数据(FileSearch)

42011-8-31

*http://club.excelhome,net/thread-759188-1-1.html

SubGetDataO

DimBrrbzdTo200,1To19),Brrgr(lTo500,1To23)

DimmyFsAsFileSearch;myfile

DimmyPathAsString,Filcnamc$,wbnm$

Dimi&,n&,mm&,aa$,nml$,j&

DimSht1AsWorksheet,shAsWorksheet,wblAsWorkbook

App1ication.ScreenUpdaling=False

Setwbl=ThisWorkbook

wbnm=Left(wbl.Name,Len(wbl.Name)-4)

SetSht1=?\ctiveSheet

Shtl.[a2:w200]=

aa=Left(Shtl.Name,2)

SetmyFs=Application.FileSearch

myPath=ThisWorkbook.Path&"\"

WithmyFs

.NewScarch

.LookIn=myPath

.FileType=msoFileTypeNoteltem

.Filename=xls”

.SearchSubFolders=True

If.Execute(Sortliy:=msoSortByFileName)>0Then

n=.FoundFiles.Count

RoDimmyfiledTon)AsString

Fori=1Ton

myfile(i)=.FoundFiles(i)

Filename=myfile(i)

nml=Split(Mid(Filename,InStrRev(Filename,"\")+1),”.")(0)

Ifnml=wbnmThenGoTo200

Workbooks.Openmyfile(i)

DimwbAsWorkbook

Setwb=ActiveWorkbook

ForEachshInSheets

IfInStr(sh.Name,aa)Then

sh.Activate

Ifaa=〃班子〃Then

mm=mm+1

Brrbz(nun,1)=[b2].Value

Forj=2To18Step2

Ifj<10Then

Brrbz(mm,j)=Cells(j/2+34,11).Value

Else

Brrbz(mm,j)=CelIs(j/2+34,9).Value

EndIf

Next

GoTo100

Else

If[b2]=ThenGoTo50

mm=mm+1

Brrgr(mm,I)=[b2].Value

Brrgr(mm,2)=[e38].Value

Brrgr(mm,3)=[i38].Value

Forj=4To18Step2

Ifj<12Then

Brrgr(mm,j)=Cells(j/2+38,8).Value

Else

Brrgr(mm,j)=Cells(j/2+38,7).Value

EndIf

Next

Forj=20To23

Brrgr(mm,j)=CelIs(j+28,8).Value

Next

EndIf

EndIf

50:

Next

100:

wb.Closesavechanges:=False

Setwb=Nothing

200:

Next

Else

MsgBox〃该文件夹里没有仃.何文件”

EndIf

EndWith

Ifaa="班子〃Then

[a2].Resize(mm,19)=Brrbz

Else

[a2].Resize(mm,23)=Brrgr

EndIf

[al].Select

SetmyFs=Nothing

EndSub

42011-7-15

'htip:〃club,excelhome,net/viewthread.php?tid=741341&pid=5036524&page=l&extra=

Subpldrsj0

'批量导入指定文件的数据

DimmyFsAsFileSearch,myfile,Brr

DimmyPath$,Filenames,nm2$

Dimi&,j&,n&,aa$,nm$

DimShtlAsWorksheet,shAsWorksheet

App1ication.Screenlpdating=False

SetShtl=ActiveSheet

Shtl.Cells.ClearContents

nm2=ActiveWorkbook.Name

SetmyFs=Application.FileScarch

myPath=ThisWorkbook.Path

WithmyFs

.NewSearch

.LookIn=myPath

.FileType=msoFileTypeNoteltem

.Filename=xls”

.SoarchSubFolders=True

If.Execute(SortBy:=msoSortByFileName)>0Then

n=.FoundFiles.Count

ReDimBrr(lTon,1To2)

ReDimmyfile(lTon)AsString

Fori=1Ton

myfile(i)=.FoundFiles(i)

Filename=myfile(i)

aa=InStrRev(Filename,〃\")

nm=Right(Filename,Len(Filename)-aa)'带后

缀的Excel文件名

Ifnm<>nm2Then

j=j•1

Workbooks.Openmyfile(i)

DimwbAsWorkbook

Setwb=ActiveWorkbook

Setsh=wb.Sheets("Sheet1")

Brr(j,1)=nm

Brr(j,2)=sh.[c3].Value

wb.C1osesavechanges:=False

Setwb=Nothing

EndIf

Next

Else

MsgBox〃该文件夹里没有任何文件〃

EndIf

EndWith

Shtl.Select

[a3].Resize(UBound(Brr),2)=Brr

SetmyFs=Nothing

Application.ScreenUpdating=True

EndSub

SubpldrsjO7O7()

'http://club.excelhome.net/thread-456387-1-1,html

'Report2.xls

'批量导入指定文件的数据

DimmyFsAsFilcScarch,myfi1e

DimmyPathAsString,Filenames,ma&,mc&

DimiAsLong,nAsLong,nn&,aa$,nm$,nml$

DimShtlAsWorksheet,shAsWorksheet

Application.Screenupdating=False

SetShtl=ActiveSheet:nn=5

Shtl.[b5:e27]=

SetmyFs=Application.FileSearch

myPath=ThisWorkbook.Path&"\data",指定的子文件夹内搜索

WithmyFs

.NewScarch

.LookIn=myPalh

.FileType=msoFi1eTypeNoteItem

.Fi1ename="*.xls”

.SearchSubFolders=True

If.Execute(SortBy:=msoSoi'tByFi1eNamc)>0Then

n=.FoundFiles.Count

ReDimmyfile(1Ton)AsString

Fori=1Ton

myfile(i)=.FoundFiles(i)

Filename=myfile(i)

nml=split(mid(filename,instrrev(filename,(0)•句

代码代替以下3句

'aa=InStrRev(Filename,"\")

*nm=Right(Filename,Len(Filename)-aa)'带后缀的Excel

文件名

'nml=Left(nm,Len(nm)-4)'去除后缀的Excel文件名

Ifnml<>Shtl.NameThen

Workbooks.Openmyfile(i)

DimwbAsWorkbook

Setwb=ActiveWorkbook

ForEachshInSheets

sh.Activate

ma=[b65536].End(xlUp).Row

Ifma>6Then,第6行是表头

Ifma>10Thenma=10'只要取4行数据

Forii=7Toma

Shtl.Cells(nn,2).Resized,3)=Cells(ii,

2).Resized,3).Value

Shtl.Cells(nn,5)=Cells(ii,6).Value

nn=nn+1

Nextii

GoTo100

Else

GoTo100

EndIf

me=[d65536].End(xlUp).Row

Ifme>7Then,第7行是表头

Ifme>11Thenme=11,只要取4行数据

Forii=8Tome

ShtLCelIs(nn,2).Resized,3)=Cells(ii,

4).Resized,3).Value

Sht1.Cells(nn,5)=Cells(ii,8).Value

nn=nn+1

Nextii

GoTo100

Else

GoTo100

EndIf

100:

Nextsh

wb.Closesavechanges:=False

Setwb=Nothing

EndIf

Next

Else

MsgBox”该文件夹里没有任何文件”

EndIf

EndWith

[al].Select

SetmyFs=Nothing

Application.ScreenUpdating=True

EndSub

'http:〃club,excelhome,net/viewthread.php?tid=46271O&pid=3020658&page=l&extra=

page%3D2

'sum.xls

Subpldrsj0724()

'批量导入指定文件的数据

DimmyFsAsFileSearch,myfile,Myrl&,Arr

DimmyPathS,Filenames,nm2$

Dimi&,j&,n&,nn&,aa$,nm$,nml$

DimShtlAsWorksheet,shAsWorksheet

Application.ScreenUpdating=False

SetShtl=ActiveSheet

Myrl=Shtl.[a65536].End(xlUp).Row

Arr=Shtl.Range("a3:b"&Myrl)

Shtl.Range("b3:b〃&Myrl).ClearContents

nm2=Loft(ActivcWorkbook.Name,Lon(ActiveWorkbook.Name)-4)

SetmyFs=Application.FileSearch

myPath=ThisWorkbook.Path

WithmyFs

.NewSearch

.LookIn=myPath

.FileType=msoFileTypeNoteltem

.Filename="*.xls”

If.Execute(SortBy:=msoSortByFileName)>0Then

n=.FoundFiles.Count

ReDimmyfile(1Ton)AsString

Fori=1Ton

myfile(i)=.FoundFiles(i)

Filename=myfile(i)

aa=InStrRev(Filename,"\")

nm=Right(Filename,Len(Filename)-aa)'带后缀的Excel文

件名

nml=Left(nm,I,en(nm)-4)'去除后缀的Excel文件名

Ifnml<>nm2Then

Workbooks.Openmyfile(i)

DimwbAsWorkbook

Sotwb=ActivcWorkbook

ForEachshInSheets

Forj=1ToUBound(Arr)

Ifsh.Name=Arr(j,1)Then

sh.Activate

Setrl=RangeCc:c*).Find(sh.Name)

nn=rl.Row

Arr(j,2)=Cells(nn,9)

GoTo100

EndIf

Nextj

Nextsh

100:

wb.Closesavechanges:=False

Setwb=Nothing

EndIf

Next

Else

MsgBox〃该文件夹里没有任何文件”

EndIf

EndWith

Sht1.Select

[b3].Resize(UBound(Arr),1)=Application.Index(Arr,0,2)

SetmyFs=Nothing

Appliccition.ScreenUpdating=True

EnclSub

6,多工作表提取指定数据(数组)

'http:〃excel,aa.topzj.com/viewthread.php?tid=399457&pid=73718&pagc=l&extra=#p

id73718

Subfpkf()

Application.ScreenUpdating=False

DimMyr&,Arr,yf,x&,Myrlft,rl

DimShtAsWorksheet

Myr=Sheet1.[b65536].End(xWp).Row

Sheet1.Rangc(z,c8:h,/&Ifyr).ClcarContcnts

Arr=Sheet1.Range("c8:h"&Myr)

[j8].Formula=*=rc[-9]|**&rc[-8]*

[j8].AutoFillRange&Myr)

Range("j8:j"&Myr)=Range("j8:j"&Myr).Value

ForEachShtInSheets

IfSht.Name<>Sheet1.NameThen

yf=Left(Sht.Name,Len(Sht.Name)-2)

Sht.Activate

Myrl=[a65536].End(xlUp).Row-1

Forx=7ToMyr1

IfCells(x,1)<>""Then

Setrl=Sheet1.Range("j:j?,).Find(CelIs(x,1)&&Cells(x,2))

IfNotrlIsNothingThen

Arr(rl.Row-7,yf)=Cells(x,"ar")

EndIf

EndIf

Nextx

EndIf

Next

Sheetl.Activate

[c8].Rosize(UBound(Arr),UBound(Arr,2))=Arr

Clear

Application.ScreenUpdating=True

EndSub

7,多工作簿多工作表查询汇总去重复值(字典数组)

'http:〃club,excelhome,net/viewthread.php?tid=485193&pid=3181286&page=l&extra=

page%3Dl

'详细记录.xls

'3个工作簿需要都打开

Subxxjl()

DimSht1AsWorksheet,ShtAsWorksheet

DimwblAsWorkbook,wb2AsWorkbook,wb3AsWorkbook

Dimi&,Myr2&,Arr2,Myr&,Arr,Myrl&,xm$,yl$

Application.ScreenUpdating=False

Setwbl=ActiveWorkbook

Setwb2=Workbooks("购进”)

Setwb3=Workbooks("配料”)

wb2.Activate

Myr2=[a65536].End(xlUp).Row

Arr2=Range("a2:d"&Myr2)

wb3.Activate

Fori=1ToUBound(Arr2)

wb3.Activate

xm=Arr2(i,2)

ForEachShtInSheets

IfSht.Name=xmThen

Sht.Activate

Myr=[a65536].End(xlUp).Row

Arr=Range(*al:b*&Myr)

Forj=1ToCBound(Arr)

yl=Arr(j,1)

wb1.Activate

ForEachShtlInSheets

IfShtl.Name=ylThon

Shtl.Activate

Myrl=[a65536].End(xlUp).Row+1

CelIs(Myrh1)=Arr2(i,1)

CelIs(Myrl,3)=Arr2(i,3)

Cells(Myrl,2)=Arr2(i,4)*Arr(j,2)

ExitFor

EndIf

Next

Nextj

GoTo100

EndIf

Next

100:

Nexti

Callqccf

Application.ScreenUpdating=True

EndSub

Subqccf()

DimShtAsWorksheet,jfyr&,Arr,i&,x

Dimd,k,t,Arrl,j&

App1ication.ScreenUpdaling=False

ForEachShtInSheets

Sht.Activate

Myr=[a65536].End(xlUp).Row

Arr=Range(*a2:c*&Myr)

Setd=CreateObject(''Scripting.Dictionary^)

IfMyr<3ThenGoTo100

Fori=1ToUBound(Arr)

x=Arr(i,1)&",〃&Arr(i,3)

IfNotd.exists(x)Then

d(x)=Arr(i,2)

Else

d(x)=d(x)+Arr(i,2)

EndIf

Next

k=d.keys

t=d.items

ReDimArrl(lToUBound(k)+1,1To3)

Forj=0ToUBound(k)

Arrl(j+1,1)=Split(k(j),",")(0)

Arrl(j+1,3)=Split(k(j),",")(1)

Arrl(j+1,2)=t(j)

Nextj

Range("a2:c〃&Myr).ClearContents

[a2].Resize(UBound(Arrl),3)=Arrl

100:

Setd=Nothing

Next

Application.ScreenUpdating=True

EndSub

8,多工作簿对比(FileSearch)

'http:〃club,excelhome,net/viewthread.php?tid=499599&pid=3285214&page=l&extra=

page%3Dl

SubdgzbdbO

'多工作簿对比

'by:蓝桥2009T1-7

DimmyFsAsFileSearch

DimmyPathAsString,Filename$

Dimi&,n&,nm$,myfile

DimSht1AsWorksheet,shAsWorksheet

DimwblAsWorkbook,yf,j&,ml&

Dimm,arr,rl

Application.ScreenUpdating=False

App1ication.DisplayA1erts=False

OnErrorResumeNext

Setwbl=ThisWorkbook

SetmyFs=Application.FileSearch

myPath=ThisWorkbook.Path

ForEachSht1InSheets

IfInStr(Shtl.[al],“费用明细表”)>0Then

nm=Left(ShtL[al],Len(Shtl.[al])5)

Sht1.Activate

WithmyFs

.NewSearch

.LookIn=myPath

.FileType=msoFileTypeNoteltem

.Filename=nm&xls”

.SearchSubFolders=True

If.Execute(SortBy:=msoSortByFileName)>0Then

myfile=.FoundFiles(1)

Workbooks.Openmyfile

Dim\vbAsWorkbook

Setwb=ActiveWorkbook

Setsh=wb.ActiveSheet

m=sh.[a65536].End(xlUp).Row

arr=sh.Range(Cells(2,1),Cells(m,6))

yf=Vai(Split(arr(2,1),".")(1))

Sht1.Activate

Forj=1ToUBound(arr)

Setrl=Shtl.Range(*c:c*).Find(arr(j,3))

IfrlIsNothingThen

ml=Shtl.[d65536].End(xlUp).Row

Cells(ml,1).EntireRow.Insertshift:=xlUp

CelIs(ml,1)=Cells(ml-1,1)+1

Cells(ml,2)=arr(j,3)

Colls(ml,yf+3)=arr(j,6)

EndIf

Nextj

wb.Closesavechanges:=Fa1se

Setwb=Nothing

EndIf

EndWith

EndIf

Next

SetmyFs=Nothing

Application.DisplayAlerts=

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论