Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Last cell determined different in XP/2003 as in 2000
Hello FellowNewsgroupReaders,
I adapted the 'last cell' macro from David McRitchie OR Chip Pearson (sorry guys, I couldn't find it back eather). This macro looks for the actual last filled cell in a sheet. It works wonderful! Until now, that is. In a sheet I created a last row that will not be used, just for a reference as the last row. All other items are added before this row. I filled it with the text "Last hidden row" and it is hidden. The sheet is protected with a password. The 'stdLastCell' macro always tells me what row that is. Now in Excel 2000 this all works fine. In Excel XP and 2003 however the las row reported is NOT the hidden last row but the visible last row. If I set off the protection of the sheet it will work fine. Here's my macro's: ************* Sub FindLast Dim Test Test = stdLastCell("Sheet1").Row End sub Function stdLastCell(strSheetname) As Range ' Returns the real last cell Dim intLastRow As Integer Dim intLastCol As Integer Dim wsSearch As Worksheet Set wsSearch = Sheets(Worksheets(strSheetname).Index) ' Error-handling On Error Resume Next With wsSearch ' find the real last row intLastRow = .Cells.Find(What:="*", _ SearchDirection:=xlPrevious, _ SearchOrder:=xlByRows).Row ' find the real liast column intLastCol = .Cells.Find(What:="*", _ SearchDirection:=xlPrevious, _ SearchOrder:=xlByColumns).Column End With ' Set stdLastCell = wsSearch.Cells(intLastRow, intLastCol) End Function ********* Any ideas why this is a difference? Rob |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Insert # of Rows determined by cell | Excel Discussion (Misc queries) | |||
Excel 2000 and 2003 stuck in cell | Setting up and Configuration of Excel | |||
Getting a value from a cell that is determined by a formula | Excel Discussion (Misc queries) | |||
Cell Protection over Excel 2000 and 2003 | Excel Discussion (Misc queries) | |||
CELL PROTECTED IN 2000, UNPROTECTED IN 2003 | Excel Worksheet Functions |