Excel VBA对于每个选定的单元格中断

我有一个macros检查任何空白单元格的范围,然后运行第二个macros。 目前,如果find一个空白单元格,用户会收到一条消息提醒他们一个空白单元格,macros结束。

我想能够在结束macros之前select空白单元格,所以用户知道在哪里find它。

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 

有没有一个select器,将空单元格作为活动?

Cell.SelectreplaceActiveCell.Select

尝试这个….

 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