ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to detect row number of selected cells? (https://www.excelbanter.com/excel-programming/360913-how-detect-row-number-selected-cells.html)

ivan

How to detect row number of selected cells?
 
Dear all,

I have to write a macro which allows user to highlight some consecutive
cells in column A, then the user click a button on the worksheet to call a
macro program and the program can detect the row numbers which cells are
highlighted. Seems hard?! The cells selected can be different each time.....
Can anyone advise? Thanks a million in advance.

Ivan


JE McGimpsey

How to detect row number of selected cells?
 
One way:

Public Sub WhichRows()
MsgBox "Rows " & Selection.EntireRow.Address(False, False, xlA1)
End Sub



In article ,
Ivan wrote:

Dear all,

I have to write a macro which allows user to highlight some consecutive
cells in column A, then the user click a button on the worksheet to call a
macro program and the program can detect the row numbers which cells are
highlighted. Seems hard?! The cells selected can be different each time.....
Can anyone advise? Thanks a million in advance.

Ivan



All times are GMT +1. The time now is 03:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com