View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dr.Schwartz Dr.Schwartz is offline
external usenet poster
 
Posts: 39
Default Determine the size of a range

Thank you Bob, that works, but I want to use it like this with cell instead:

Dim Headers as Range
Set Headers = Range(Cells(45, 2).End(xlToRight).Column)

I get an: Method 'Range' of object '_worksheet' failed error.
Almost there, please help me out. Thanks.

"Bob Phillips" wrote:

Almost Doc!

Range("A5").End(xltoRight).Column

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Dr.Schwartz" wrote in message
...
Thanks Norman - just what I was looking for.

Now I'm trying to apply this to columns using:

Range("A5").End(xlRight).Column

Without luck
Can you perhaps help me out?

Thanks, The Doctor

"Norman Jones" wrote:

Hi Dr Schwartz,

1. The number of rows in the range (answer = 3)
Range("A5").End(xlDown).Row -Range("A5").Row + 1

2. The last row number in the range (answer =7)
Range("A5").End(xlDown).Row

---
Regards,
Norman



"Dr.Schwartz" wrote in message
...
Say I have values in cell A5, A6 and A7, what is the easiest way to
determine:
1. The number of rows in the range (answer = 3)
2. The last row number in the range (answer =7)

The first row number is known (5) as variable: fstRow

I can do it by counting every cell until I get to the first empty cell
with
a Do until...loop routine, but it seems like a lot of code to

determine a
simple thing. Agree?

Thank you
The Doctor