前沿论坛-回复帖子
 前沿论坛->[* 办公自动化 *]->回复帖子
    

 回复帖子:将若干部门预算表放置一个文件夹然后汇总
 呢 称:  点此注册
 密 码:  忘记密码
 接头码:  (请向院线财务部查询最新接头码!)
 验证码:  验证码
 主 题:
 内 容:   加粗 下划线 斜体 插入图片 插入flash 插入音乐 插入视频 插入real媒体 插入引用 插入超级链接 插入邮件 插入列表 插入网页

( 察看文章长度 )
   

 主题:将若干部门预算表放置一个文件夹然后汇总
 正文:
预算取数各部门
Private Sub File1_Click()

File1.Path = "D:\青云富\9-预算执行情况\2010影城预算\2-2010年目标预算\2010年新街口店预算\新街口各部门预算数据"
File1.Pattern = "*.xls"

Dim xlapp As Excel.Application
Dim xlbook As Excel.Workbook
Dim xlb As Excel.Workbook
Dim xlsheet As Excel.Worksheet

Set xlapp = New Excel.Application
xlapp.Visible = True
Set xlbook = xlapp.Workbooks.Open("D:\青云富\9-预算执行情况\2010影城预算\2-2010年目标预算\2010年新街口店预算\23-万达影城预算编制(底稿)-2010财年-南京万达影城-200909")
Dim i, x, ii As Integer
For i = 0 To File1.ListCount
Set xlb = xlapp.Workbooks.Open("D:\青云富\9-预算执行情况\2010影城预算\2-2010年目标预算\2010年新街口店预算\新街口各部门预算数据\" & File1.List(i))
If InStr(File1.List(i), "营销部") Then
ii = 2
xlb.Worksheets(ii).Select
xlb.Worksheets(ii).Unprotect Password:="wandacaiwu"
Cells.Select
Selection.Copy
Windows("23-万达影城预算编制(底稿)-2010财年-南京万达影城-200909.xls").Activate
xlbook.Worksheets(ii).Unprotect Password:="wandacaiwu"
xlbook.Worksheets(ii).Select
Range("a1").Select
ActiveSheet.Paste
Windows(File1.List(i)).Activate
ii = 4
xlb.Worksheets(ii).Select
xlb.Worksheets(ii).Unprotect Password:="wandacaiwu"
Cells.Select
Selection.Copy
Windows("23-万达影城预算编制(底稿)-2010财年-南京万达影城-200909.xls").Activate
xlbook.Worksheets(ii).Unprotect Password:="wandacaiwu"
xlbook.Worksheets(ii).Select
Range("a1").Select
ActiveSheet.Paste
Windows(File1.List(i)).Activate
ii = 5
xlb.Worksheets(ii).Select
xlb.Worksheets(ii).Unprotect Password:="wandacaiwu"
Cells.Select
Selection.Copy
Windows("23-万达影城预算编制(底稿)-2010财年-南京万达影城-200909.xls").Activate
xlbook.Worksheets(ii).Unprotect Password:="wandacaiwu"
xlbook.Worksheets(ii).Select
Range("a1").Select
ActiveSheet.Paste
End If
If InStr(File1.List(i), "营运部") Then
ii = 3
xlb.Worksheets(ii).Select
xlb.Worksheets(ii).Unprotect Password:="wandacaiwu"
Cells.Select
Selection.Copy
Windows("23-万达影城预算编制(底稿)-2010财年-南京万达影城-200909.xls").Activate
xlbook.Worksheets(ii).Unprotect Password:="wandacaiwu"
xlbook.Worksheets(ii).Select
Range("a1").Select
ActiveSheet.Paste
Windows(File1.List(i)).Activate
ii = 6
xlb.Worksheets(ii).Select
xlb.Worksheets(ii).Unprotect Password:="wandacaiwu"
Cells.Select
Selection.Copy
Windows("23-万达影城预算编制(底稿)-2010财年-南京万达影城-200909.xls").Activate
xlbook.Worksheets(ii).Unprotect Password:="wandacaiwu"
xlbook.Worksheets(ii).Select
Range("a1").Select
ActiveSheet.Paste
End If
If InStr(File1.List(i), "放映部") Then
ii = 7
xlb.Worksheets(ii).Select
xlb.Worksheets(ii).Unprotect Password:="wandacaiwu"
Cells.Select
Selection.Copy
Windows("23-万达影城预算编制(底稿)-2010财年-南京万达影城-200909.xls").Activate
xlbook.Worksheets(ii).Unprotect Password:="wandacaiwu"
xlbook.Worksheets(ii).Select
Range("a1").Select
ActiveSheet.Paste
End If
If InStr(File1.List(i), "财务部") Then
ii = 8
xlb.Worksheets(ii).Select
xlb.Worksheets(ii).Unprotect Password:="wandacaiwu"
Cells.Select
Selection.Copy
Windows("23-万达影城预算编制(底稿)-2010财年-南京万达影城-200909.xls").Activate
xlbook.Worksheets(ii).Select
xlbook.Worksheets(ii).Unprotect Password:="wandacaiwu"
Range("a1").Select
ActiveSheet.Paste
Windows(File1.List(i)).Activate
ii = 9
xlb.Worksheets(ii).Select
xlb.Worksheets(ii).Unprotect Password:="wandacaiwu"
Cells.Select
Selection.Copy
Windows("23-万达影城预算编制(底稿)-2010财年-南京万达影城-200909.xls").Activate
xlbook.Worksheets(ii).Unprotect Password:="wandacaiwu"
xlbook.Worksheets(ii).Select
Range("a1").Select
ActiveSheet.Paste
Windows(File1.List(i)).Activate
ii = 10
xlb.Worksheets(ii).Select
xlb.Worksheets(ii).Unprotect Password:="wandacaiwu"
Cells.Select
Selection.Copy
Windows("23-万达影城预算编制(底稿)-2010财年-南京万达影城-200909.xls").Activate
xlbook.Worksheets(ii).Unprotect Password:="wandacaiwu"
xlbook.Worksheets(ii).Select
Range("a1").Select
ActiveSheet.Paste
End If
If InStr(File1.List(i), "行政部") Then
ii = 11
xlb.Worksheets(ii).Select
xlb.Worksheets(ii).Unprotect Password:="wandacaiwu"
Cells.Select
Selection.Copy
Windows("23-万达影城预算编制(底稿)-2010财年-南京万达影城-200909.xls").Activate
xlbook.Worksheets(ii).Unprotect Password:="wandacaiwu"
xlbook.Worksheets(ii).Select
Range("a1").Select
ActiveSheet.Paste
Windows(File1.List(i)).Activate
ii = 12
xlb.Worksheets(ii).Select
xlb.Worksheets(ii).Unprotect Password:="wandacaiwu"
Cells.Select
Selection.Copy
Windows("23-万达影城预算编制(底稿)-2010财年-南京万达影城-200909.xls").Activate
xlbook.Worksheets(ii).Unprotect Password:="wandacaiwu"
xlbook.Worksheets(ii).Select
Range("a1").Select
ActiveSheet.Paste
End If

xlb.Close (True)
100: Next i
xlbook.Close (True)
End Sub

前沿论坛 Ver2.5, Copyright (C), Powered By Leon Li