【发布时间】:2017-11-20 07:58:58
【问题描述】:
假设我想将这五个单元格一起比较(其中“行”是一个整数),如果它们都包含这些确切的词“不适用”,我希望输出中的单元格也是“不适用”我尝试将 .Text 替换为 .Value 但它也不起作用。总是有一个运行时错误“13”
Private Sub CommandButton1_Click()
Dim DocNo As Integer
Dim line As Integer
DocNo = (InputBox("Please input document number of record you would like to view"))
line = 1
'Checks the first cell of the results sheet until the number in first cell = the DocNo
'if "DocNo" = the number in the cell, Line is set to its respective y coordinate
Do
line = line + 1
Loop While (DocNo <> Worksheets("Results").Cells(line, 1))
If (Worksheets("Results").Cells(line, 5).Text) And
(Worksheets("Results").Cells(line, 57).Text) And
(Worksheets("Results").Cells(line, 59).Text) And
(Worksheets("Results").Cells(line, 32).Text) And
(Worksheets("Results").Cells(line, 40).Text) = "Not Applicable" Then
Worksheets("Output").Cells(26, 3) = "Not Applicable"
End If
End Sub
如果这是一些愚蠢的错误,请原谅我,我才开始使用 VBA 几天
【问题讨论】:
-
投票关闭它,因为所描述的错误是由于(少数)错别字,而不是算法本身。 @Ledavidiado:如果您遇到更多麻烦,请随时提出新问题或编辑此问题以反映问题所在。