我在使用生成参考编号的表格时遇到了问题。但是当我尝试生成参考号时。它有一条错误消息说:
运行时错误“1004”:对象“_Global”的方法“范围”失败
当我点击 Debug button 时,它显示如下代码:
它突出显示代码第 4 行的错误
Sub clearTemplate()
' Clear Template Content
Range(inputTemplateHeader) = NO_ENTRY
Range(inputTemplateContent) = NO_ENTRY - (highlighted error)
End Sub
Sub clearRefNo()
' Clear cell G2 reference number
Range(cellRefNo) = NO_ENTRY
' Open "Report_ref_no.xls"
If Not (IsFileOpen) Then Workbooks.Open filename:=ThisWorkbook.Path & "\" & FACCESS
' Activate "Report_ref_no.xls"
Windows(FACCESS).Activate
' Access column D
Range(cellFirstRefNo).Select
Selection.End(xlDown).Select
If refNo = Cells(ActiveCell.Row, ActiveCell.Column - 1).Value Then
' Log Development Code column
Cells(ActiveCell.Row, ActiveCell.Column) = NO_ENTRY
' Log Issuer column
Cells(ActiveCell.Row, ActiveCell.Column + 1).Value = NO_ENTRY
' Log Date column
Cells(ActiveCell.Row, ActiveCell.Column + 2).Value = NO_ENTRY
End If
' Save & Close workbook
ActiveWindow.Close True
End Sub
谁能帮我解决这个问题?我不知道出了什么问题?