View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jerry W. Lewis
 
Posts: n/a
Default How many rows have I selected ?

There is no worksheet function for this. Take Norman's suggestion and
write it as a VBA User Defined Function

Function rowsSelected()
Application.Volatile
rowsSelected = Selection.Rows.Count
End Function

Declaring the the function to be volatile is necessary to get it to
recalculate in future recalculation events.

Jerry

Paul Ho wrote:

Hi, Norman,

Thanks for you help. But I need is function, not VBA. Is it any?

Regards
Paul

"Norman Jones" wrote:


Hi Paul,

Assiming you are referring to VBA, try:

Dim NumOfRows As Long

NumOfRows = Selection.Rows.Count

---
Regards,
Norman


"Paul Ho" wrote in message
...

Hi,

Any function that could tell me how many rows have I selected?
i.e. I have selected cells(A1:E5), the function could show me 5 row.

Thanks