Excel VBA,用于中断时选择的每个单元格
我有一个宏,它检查一个区域中是否有空白单元格,然后运行第二个宏。目前,如果发现空白单元格,用户将收到一条消息,提醒他们有空白单元格,宏将结束 我希望能够在结束宏之前选择空白单元格,这样用户就知道在哪里找到它。Excel VBA,用于中断时选择的每个单元格,vba,excel,Vba,Excel,我有一个宏,它检查一个区域中是否有空白单元格,然后运行第二个宏。目前,如果发现空白单元格,用户将收到一条消息,提醒他们有空白单元格,宏将结束 我希望能够在结束宏之前选择空白单元格,这样用户就知道在哪里找到它。 Dim e As Range Set e = Range("A2", Range("A1000").End(xlUp)) For Each Cell In e If IsEmpty(Cell) Then ActiveCell.Select MsgB
Dim e As Range
Set e = Range("A2", Range("A1000").End(xlUp))
For Each Cell In e
If IsEmpty(Cell) Then
ActiveCell.Select
MsgBox ("Please remove empty row")
Cancel = True
Application.StatusBar = vbNullString
Exit Sub
End If
Next
是否有一个选择器可以使空单元格保持活动状态?替换
ActiveCell。选择替换单元格。选择替换ActiveCell。选择替换单元格。选择替换单元格。选择尝试此操作
Sub test()
Dim e As Range
Set e = Range("A2", Range("A1000").End(xlUp))
For Each Cell In e
If IsEmpty(Cell) Then
Cell.Select
MsgBox ("Please remove empty row")
Exit Sub
End If
Next
End Sub
试试这个
Sub test()
Dim e As Range
Set e = Range("A2", Range("A1000").End(xlUp))
For Each Cell In e
If IsEmpty(Cell) Then
Cell.Select
MsgBox ("Please remove empty row")
Exit Sub
End If
Next
End Sub