Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find the last used Row on a Worksheet


Hi Experts

Is it possible for me to select the blank row immediately after th
last used row? I am trying to do something like this, but it's no
working:


Code
-------------------
lastrow = Cells(Rows.count, "B").End(xlUp).Row
lastrow2 = lastrow + 2
Range("A65536").End(xlToRight).Select = "lastrow2"

OR

Range("lastrow2").End(xlToRight).Select

-------------------


Kind Regard

--
popp
-----------------------------------------------------------------------
poppy's Profile: http://www.excelforum.com/member.php...fo&userid=1145
View this thread: http://www.excelforum.com/showthread.php?threadid=32006

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Find the last used Row on a Worksheet

The UsedRange property of the worksheet will get it for you:
LastRow = Worksheets(SheetName).UsedRange.Rows.Count
(this gives the last used row, the blank row would be this plus one)

"poppy" wrote:


Hi Experts

Is it possible for me to select the blank row immediately after the
last used row? I am trying to do something like this, but it's not
working:


Code:
--------------------
lastrow = Cells(Rows.count, "B").End(xlUp).Row
lastrow2 = lastrow + 2
Range("A65536").End(xlToRight).Select = "lastrow2"

OR

Range("lastrow2").End(xlToRight).Select

--------------------


Kind Regards


--
poppy
------------------------------------------------------------------------
poppy's Profile: http://www.excelforum.com/member.php...o&userid=11453
View this thread: http://www.excelforum.com/showthread...hreadid=320060


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Find the last used Row on a Worksheet

lastrow = Cells(Rows.Count, "B").End(xlUp).Row
Range("B" & lastrow+1).Value = "lastrow2"

--

HTH

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


"poppy" wrote in message
...

Hi Experts

Is it possible for me to select the blank row immediately after the
last used row? I am trying to do something like this, but it's not
working:


Code:
--------------------
lastrow = Cells(Rows.count, "B").End(xlUp).Row
lastrow2 = lastrow + 2
Range("A65536").End(xlToRight).Select = "lastrow2"

OR

Range("lastrow2").End(xlToRight).Select

--------------------


Kind Regards


--
poppy
------------------------------------------------------------------------
poppy's Profile:

http://www.excelforum.com/member.php...o&userid=11453
View this thread: http://www.excelforum.com/showthread...hreadid=320060



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Find the last used Row on a Worksheet

Hi K Dales

This is only working if you have data in the first row of your sheet

You can use this to find the last row with data

Firstrow = ActiveSheet.UsedRange.Cells(1).Row
Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1
--
Regards Ron de Bruin
http://www.rondebruin.nl


"K Dales" wrote in message ...
The UsedRange property of the worksheet will get it for you:
LastRow = Worksheets(SheetName).UsedRange.Rows.Count
(this gives the last used row, the blank row would be this plus one)

"poppy" wrote:


Hi Experts

Is it possible for me to select the blank row immediately after the
last used row? I am trying to do something like this, but it's not
working:


Code:
--------------------
lastrow = Cells(Rows.count, "B").End(xlUp).Row
lastrow2 = lastrow + 2
Range("A65536").End(xlToRight).Select = "lastrow2"

OR

Range("lastrow2").End(xlToRight).Select

--------------------


Kind Regards


--
poppy
------------------------------------------------------------------------
poppy's Profile: http://www.excelforum.com/member.php...o&userid=11453
View this thread: http://www.excelforum.com/showthread...hreadid=320060




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find the last used Row on a Worksheet


Hi Experts

Thanx for all the quick responses. Got it working.


Kind Regard

--
popp
-----------------------------------------------------------------------
poppy's Profile: http://www.excelforum.com/member.php...fo&userid=1145
View this thread: http://www.excelforum.com/showthread.php?threadid=32006

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find and unlink current worksheet from old worksheet kmjmail Excel Discussion (Misc queries) 3 January 12th 09 10:52 PM
Find worksheet LantzK Excel Discussion (Misc queries) 1 May 23rd 08 05:19 PM
Find Max Value in WorkSheet Corey Excel Worksheet Functions 11 January 14th 07 11:00 PM
Find a worksheet Luis Excel Programming 1 August 6th 04 11:45 AM
find last row on a worksheet tracey Excel Programming 3 February 3rd 04 10:39 PM


All times are GMT +1. The time now is 02:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"