我需要Excel中的幫助。我的問題是:如何獲得此循環中每行的單元格42?正如:excel vba中的行上循環並獲取單元格
For Each r In Sheets("Sheet2").UsedRange.Rows
sval = r.Cells(42)
If sval = "" Then
If r.Cells(6).Value <> "" And r.Cells(7).Value <> "" And r.Cells(9).Value <> "" And r.Cells(10).Value <> "" And r.Cells(11).Value <> "" And r.Cells(12).Value <> "" Then
MsgBox "wtehi"
r.EntireRow.Interior.ColorIndex = 0
Else
MsgBox "yallow"
emptyMand = "ok"
r.EntireRow.Interior.ColorIndex = 6
End If
End If
Next
你究竟是什麼意思?每列第42行? – ApplePie
我想循環工作表中的每一個使用的行,並希望獲得第42列的單元格和值爲上述的每一行,我想看到列的值是空的,然後想要看看單元格6 7 9 10 11 12是空的,然後使行的顏色爲白色,否則使yallow – samimvp