vb操作excel

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Print xlbook3.sheets.Count
xlbook3.SaveAs "i:\123.xls"
xlbook1.Close
xlbook2.Close
xlbook3.Close
XLAPP.quit
xlbook3.sheets(i).Cells(10, 1).Value = "通知出厂日期:" & Format(xlbook2.sheets(1).Cells(i + 2, 2).Value - 7, "yyyy年m月d日")
Else
xlbook3.sheets(i).Cells(10, 1).Value = "通知出厂日期:" & Format(xlbook2.sheets(1).Cells(i + 2, 2).Value - 5, "yyyy年m月d日")
Cls
Print "正在处理第" & i & "张表格"
Print "进度:" & Format(i / (N - 2), "00.0%")
xlSheet1.Copy Before:=xlbook3.sheets(i)
Dim Mydate
xlbook3.sheets(i).Name = Year(xlbook2.sheets(1).Cells(i + 2, 2).Value) & "_" & i
Next
xlbook3.sheets(xlbook3.sheets.Count).Delete
Print "ok"
End Sub
vb操作excel,读取一张表格数据处理后放入另一张表格。
Private Sub Command1_Click()
Set XLAPP = CreateObject("Excel.Application")
XLAPP.Visible = False
XLAPP.DisplayAlerts = False
Set xlbook1 = XLAPP.Workbooks.open("i:\水泥产品合格证模板.xls")
Set xlSheet1 = xlbook1.worksheets(1)
Set xlbook2 = XLAPP.Workbooks.open("i:\水泥进场登记汇总表.xls")
Set xlSheet2 = xlbook2.worksheets(1)
Set xlbook3 = XLAPP.Workbooks.Add
Print
Print
ห้องสมุดไป่ตู้ Print
Dim N As Long '有效行数
Mydate = xlbook2.sheets(1).Cells(i + 2, 2).Value '日期
Mydate = Year(Mydate) & Month(Mydate)
If Mydate = "20091" Or Mydate = "20092" Or Mydate = "20093" Or Mydate = "20094" Or Mydate = "20097" Then
End If
xlbook3.sheets(i).Cells(11, 1).Value = "出厂编号:" & xlbook2.sheets(1).Cells(i + 2, 8).Value
xlbook3.sheets(i).Cells(21, 9).Value = i
For i = 1 To edRange.Rows.Count '内置函数计算的有效行数
If xlbook2.sheets(1).Cells(i, 1).Value = "" Then Exit For
N = N + 1
Next
For i = 1 To N - 2
相关文档
最新文档