Last row in range
-
- BronzeLounger
- Posts: 1246
- Joined: 03 Feb 2010, 19:59
- Location: Terneuzen, the Netherlands
Last row in range
If I have a range, e.g. Range("A2:A5000"), how do I get the last row (5000) in a variable? I tried "Specialcells(xlCellTypeLastCell)" but that gave me something like 5348... odd...
-
- Administrator
- Posts: 12609
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Last row in range
Assume that you have a named range, MyRange, then the last row would be
Range("MyRange").Rows.Count + Range("MyRange").Row - 1
If you have a variable rngHereitis then you can use rngHereitis instead of Range("MyRange") in that example
Range("MyRange").Rows.Count + Range("MyRange").Row - 1
If you have a variable rngHereitis then you can use rngHereitis instead of Range("MyRange") in that example
StuartR
-
- Administrator
- Posts: 78494
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Last row in range
By the way, Erik Jan, your mail server is bouncing the e-mail notifications of replies to your questions as spam...
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1246
- Joined: 03 Feb 2010, 19:59
- Location: Terneuzen, the Netherlands
Re: Last row in range
Works, thank youStuartR wrote:Assume that you have a named range, MyRange, then the last row would be
Range("MyRange").Rows.Count + Range("MyRange").Row - 1
If you have a variable rngHereitis then you can use rngHereitis instead of Range("MyRange") in that example
-
- BronzeLounger
- Posts: 1246
- Joined: 03 Feb 2010, 19:59
- Location: Terneuzen, the Netherlands
Re: Last row in range
Thanks Hans, working on it... if you reply to this one (as you know ;-))HansV wrote:By the way, Erik Jan, your mail server is bouncing the e-mail notifications of replies to your questions as spam...
-
- Administrator
- Posts: 78494
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Last row in range
OK, here you go.
This is a test to see if e-mail notifications are still rejected by your mail server.
This is a test to see if e-mail notifications are still rejected by your mail server.
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78494
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Last row in range
Still bouncing. I've sent you a PM with the text of one of the failure messages.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1246
- Joined: 03 Feb 2010, 19:59
- Location: Terneuzen, the Netherlands
Re: Last row in range
Should be fixed now... I added the sending address to a "Senders Whitelist" in my Spam filter. Thanks again for letting me know the emails bounced...
-
- Administrator
- Posts: 78494
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- BronzeLounger
- Posts: 1246
- Joined: 03 Feb 2010, 19:59
- Location: Terneuzen, the Netherlands
-
- Administrator
- Posts: 78494
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands