我需要在一列中找到一个特定的单词/字符(现在假设为“X”),然后查看该特定行以查找数字不是“0”的单元格地址。
X可能会在该特定列中出现多次,VBA应该选择每个实例并重复检查“0”以外的数字。
最后,我需要一个不是“0”的单元格地址列表,以及第一列中带“X”的行。如果这可能出现在消息框中,则为最佳。
提前致谢。
编辑:已尝试过的代码:
Sub checkx()
Dim searchResult As Range
Dim mismatch As Range
Dim x As Integer
y = 116
Set searchResult = Cells(1, 1).EntireColumn.Find(what:="x", LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
Set mismatch = Cells(searchResult, 1).EntireRow.Find(what:="flag", LookIn:=xlFormulas, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False)
firstcheck = searchResult.Address
Do
Cells(y, 1) = searchResult.Row
Cells(y, 2) = mismatch.Row
x = x + 1
Set searchResult = Cells.FindNext(searchResult)
Set mismatch = Cells.FindNext(mismatch)
Loop While Not searchResult Is Nothing And firstcheck <> searchResult.Address
End Sub