View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
sommer sommer is offline
external usenet poster
 
Posts: 3
Default Define name, count rows problem.

I would like to count the number of rows in a named range that contains
multiple areas on the same worksheet. To setup the range, I held the Control
key down while selecting the three different areas and then selected
InsertNameDefine to establish the €śdata€ť range. The following code yields
10 rows and not the expected 21. It appears the code only considers the first
part of the named range and not the entire string.
Any help would be appreciated.
Thanks
Sommer

Names in workbook:
data

Refers to:
=Sheet1!$A$3:$M$12,Sheet1!$A$25:$M$30,Sheet1!$A$40 :$M$44

Macro code:
Set CheckArea = Range(€śdata€ť)
NumberOfRows = CheckArea.Rows.Count