Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Excel2000: finding last row of used range

Hi

In my procedure I need to determine last used row on worksheet, and I tried
with:
LastRow = Sheets("SheetName").Cells.SpecialCells(xlCellTypeL astCell).Row

At start it looked fine - until I found, that when I p.e. delete some rows
from used range, the SpecialCells(xlCellTypeLastCell) isn't actualized until
I haven't saved my workbook.

The procedure sets the number of premade rows - formated and with formulas
ready for use - to number determined by user. It simply deletes abundant
rows (there is a limit for minimum number of rows left) from bottom of used
range, or adds a number of copies of last row(s).

To save the workbook every time before to reset it can be too
time-consuming. Is there a better way to determine the number of last used
row on worksheet?


Thanks in advance for your help
--
Arvi Laanemets
(When sending e-mail, use address arvil<Attarkon.ee)



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Excel2000: finding last row of used range

Hi Arvi,

Arvi Laanemets schrieb:
In my procedure I need to determine last used row on worksheet, and I tried
with:
LastRow = Sheets("SheetName").Cells.SpecialCells(xlCellTypeL astCell).Row

At start it looked fine - until I found, that when I p.e. delete some rows
from used range, the SpecialCells(xlCellTypeLastCell) isn't actualized until
I haven't saved my workbook.


try this:

LastRow = Sheets("SheetName").Cells.Find("*", searchdirection:=xlPrevious).Row

--
Regards
Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Excel2000: finding last row of used range

Thanks! It did it!


--
Arvi Laanemets
(When sending e-mail, use address arvil<Attarkon.ee)



"Melanie Breden" wrote in message
...
Hi Arvi,

Arvi Laanemets schrieb:
In my procedure I need to determine last used row on worksheet, and I

tried
with:
LastRow = Sheets("SheetName").Cells.SpecialCells(xlCellTypeL astCell).Row

At start it looked fine - until I found, that when I p.e. delete some

rows
from used range, the SpecialCells(xlCellTypeLastCell) isn't actualized

until
I haven't saved my workbook.


try this:

LastRow = Sheets("SheetName").Cells.Find("*",

searchdirection:=xlPrevious).Row

--
Regards
Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)



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
Excel2000:How to link Print Area with a named range Arvi Laanemets Excel Discussion (Misc queries) 5 April 8th 08 02:35 PM
Excel2000:How to link Print Area with a named range Arvi Laanemets Excel Worksheet Functions 5 April 8th 08 02:35 PM
finding a value between a range Susan Excel Worksheet Functions 9 March 6th 07 12:07 AM
Finding a value associated with a range Raymond Gallegos Excel Worksheet Functions 5 November 25th 05 08:38 PM
finding if name within range sheila Excel Worksheet Functions 9 September 13th 05 04:24 AM


All times are GMT +1. The time now is 08:49 AM.

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"