我有以下表格
我正在使用下面的代码来获取不同工作表中空白单元格的报告
Sub Loop_Column_Row()
Dim lRow, lCol As Long
'Counter
Dim i As Integer
'Find the last non-blank cell in row 1
'This assumes that the first 5 row has column headers
lCol = Cells(6, Columns.Count).End(xlToLeft).Column
i = 1
'Loop through columns
For x = 1 To lCol
'Find the last non-blank cell in the column
lRow = Cells(Rows.Count, x).End(xlUp).Row
'Loop through rows
'Start from row 2 as row 1 is the row with headers
For y = 6 To lRow
If Cells(y, x) = "" Then
'Write in column A of Sheet3
ThisWorkbook.Worksheets("ReportEmptyCell").Range("A" & i).Value = "Cell in Row: " & y & " Column: " & x & " is empty"
i = i + 1
End If
Next y
Next x
End Sub
以特定格式返回我的结果
我想修改此代码,使空行变为红色,最终结果应如下所示,因为 Col3 永远不会为空