我有以下在Excel 2007中使用的vba代码。它运行正常。我想为用户增强这一点。
它目前隐藏了用户在表单中提交的所有已完成的行。代码当前检查所有提交数据行,如果用户提交了所有必要数据,则隐藏该行。我想知道在哪里可以放置代码来执行此操作,但仅限于可见行?现在,每次运行宏时它会遍历所有这些,重新检查过去提交的清除检查的提交。我只需要它来检查新的数据行。
我是新手写的vba代码这么简单的解释或放置的地方的例子非常感谢。
Dim lASTrOW As Long, C As Range
lASTrOW = Cells(Cells.Rows.Count, "A").End(xlUp).Row
On Error Resume Next
For Each C In Range("V4:V" & lASTrOW)
If C.Value = 0 Then
C.EntireRow.Hidden = True
ElseIf C.Value = "null" Then
C.EntireRow.Hidden = False
End If
Next
If C.Value = "null" Then
MsgBox "Visible rows contain missing data. Review and update."
End If
答案 0 :(得分:0)
如果我理解了您的需求,请尝试
For Each C In Range("V4:V" & lASTrOW).specialcells(xlCellTypeVisible)