【发布时间】:2012-12-14 16:11:05
【问题描述】:
我需要 Excel 方面的帮助。我的问题是:如何在此循环中获取每行的单元格 42?如:
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 行?
-
我想为工作表中的每一个使用的行循环,并想像上面那样为每一行获取第 42 列的单元格和值,我想看看列的值是空的然后想查看单元格 6 7 9 10 11 12 是否为空,然后将行的颜色设为白色,否则将其设为黄色