'单元格触发事件Private Sub Worksheet_SelectionChange(ByVal Target As Range)If Target.Count = 1 Then MsgBox "当前单元格的行号是:" & Target.RowEnd IfEnd Sub用命令按钮的宏:Sub YY() MsgBox "当前单元格的行号:" & ActiveCell.RowEnd Sub