pdf2pdf

Sub 按模板修改Excel文件()

 

Dim MoBanWorkBook As Workbook
Set MoBanWorkBook = Application.ActiveWorkbook

Dim MoBanSheet As Worksheet
Set MoBanSheet = MoBanWorkBook.Worksheets(1)

 

With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = True
.Filters.Clear
.Filters.Add "DAT FILE", "*.xls"
.Show
For i = 1 To .SelectedItems.Count

Dim theFile As String
theFile = .SelectedItems(i)

If MoBanWorkBook.FullName <> theFile Then

 

Dim theFileWorkBook As Workbook
Set theFileWorkBook = Workbooks.Open(Filename:=theFile)

Dim TheSheet As Worksheet
Set TheSheet = theFileWorkBook.Worksheets(1)

 

For Each Item In MoBanWorkBook.Names

\'模板中的命名区域,枚举后赋予其他文件同样的值
Dim theAddress As String
theAddress = MoBanSheet.Range(Item).Address

TheSheet.Range(theAddress).Value = MoBanSheet.Range(theAddress).Value

 


Next Item

 

theFileWorkBook.Save
theFileWorkBook.Close

End If
Next
End With

 

End Sub

分类:

技术点:

相关文章:

  • 2021-11-23
  • 2021-08-29
  • 2021-12-04
  • 2021-12-04
  • 2021-12-13
  • 2021-12-13
  • 2021-10-18
猜你喜欢
  • 2021-12-31
  • 2021-12-09
  • 2021-06-21
  • 2021-12-19
  • 2021-12-13
  • 2021-09-21
  • 2021-11-02
相关资源
相似解决方案