以下是我正在尝试调试的Excel宏,但我之前从未使用过这些。
第Set log = Sheets("Quote Log")
行以黄色突出显示,错误为Sheets("Quote Log")
= 下标超出范围
Sub Feasibility()
Dim Feasibility As Workbook
Dim FeasibilitySheet, log As Worksheet
Dim row, rowSize, x As Integer
Dim UAI, customer, today, prodNum, name As String
Set log = Sheets("Quote Log")
Application.ScreenUpdating = False
If checkSelection() Then
row = getSelectionRow()
rowSize = getSelectionRowSize()
For x = row To rowSize
Set Feasibility = Workbooks.Open(Environ$("UserProfile") & "\My Documents\" & "QF-010 UMD Team Feasibility R1.xlsx")
Set FeasibilitySheet = Feasibility.Sheets("Feasibility")
UAI = log.Cells(x, 1)
customer = log.Cells(x, 2)
prodNum = log.Cells(x, 5)
name = log.Cells(x, 6)
today = log.Cells(x, 17)
FeasibilitySheet.Range("B3") = customer
FeasibilitySheet.Range("F3") = today
FeasibilitySheet.Range("C4") = prodNum
FeasibilitySheet.Range("C5") = name
FeasibilitySheet.Range("D41") = today
FeasibilitySheet.Range("D43") = today
FeasibilitySheet.Range("E45") = today
Feasibility.SaveAs Environ$("UserProfile") & "\My Documents\" & _
"Feasibility " & prodNum & " " & UAI & ".xls"
Feasibility.Close
Next
End If
''''
Application.ScreenUpdating = True
'RFI
End Sub