|
本帖最后由 nancy_nanxizi 于 2014-6-9 17:02 编辑
以下代码是用来批量下单的,单子的格式是固定的,只是每个单子里填的信息不一样,这些信息都是从另一个表格里读出来的。现在的问题是我把这串代码从一个工作簿(.xls)复制到另外一个工作簿(.xlsm)运行时,给m赋值的那一行跳出错误:unable to get the match property of the worksheetfunction clase. 实在找不出原因,特请赐教,不胜感激!
Sub RFQ_s()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim applydate As String, n%
Dim bwno As String
Dim project As String
Dim projectno As String
Dim supplier As String
Dim hour As String
Dim year As String
Dim dateon As String
Dim dateoff As String
Dim TL As String
'Dim ep As String
With ThisWorkbook
Dim today As String
Dim Formula As String
Dim m As Integer
Dim h As Integer
Dim ARR
today = Application.WorksheetFunction.Text(Now(), "yyyy-mm-dd")
ARR = .Sheets("list").Range("I:I")
m = Application.WorksheetFunction.Match(today, .Sheets("list").Range("I:I"), 0)
h = Application.WorksheetFunction.CountA(.Sheets("list").Range("I:I"))
For n = m To h
applydate = .Sheets("list").Cells(n, 9).Value
bwno = .Sheets("list").Cells(n, 10).Value
supplier = .Sheets("list").Cells(n, 3).Value
hour = .Sheets("list").Cells(n, 5).Value
year = .Sheets("list").Cells(n, 11).Value
.Sheets("RFQ_s").[b5] = applydate
.Sheets("RFQ_s").[h5] = "BW" + bwno + "/" + year
.Sheets("RFQ_s").[c42] = supplier
.Sheets("RFQ_s").[f42] = hour
.Sheets("RFQ_s").Copy
ActiveWorkbook.SaveAs Filename:="L:\85_PUBLIC\18_Supplier_Hour\sum\RFQ\" & "\BW" & bwno & "_" & year & "_Purchasing_design_supplier.xls", FileFormat:=xlNormal
ActiveSheet.UsedRange = ActiveSheet.UsedRange.Value
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End With
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Call printall
MsgBox "DONE"
End Sub
|
|