ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determining last active cell in a protected worksheet (https://www.excelbanter.com/excel-programming/369719-determining-last-active-cell-protected-worksheet.html)

Paul

Determining last active cell in a protected worksheet
 
I need to ascertain the last used cell (actually the last used row and the
last used column) in a protected worksheet.

I have tried specialcells(xlLastCell) but this fails when the sheet is
protected.

Any help appreciated

scott

Determining last active cell in a protected worksheet
 
Have you tried ctrl-end? Unless you're doing it through VBA. Then you can
always try
myLastRow = _
.Cells.Find("*", After:=.Cells(1), _
LookIn:=xlFormulas, LookAt:=xlWhole, _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row
myLastCol = _
.Cells.Find("*", After:=.Cells(1), _
LookIn:=xlFormulas, LookAt:=xlWhole, _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByColumns).Column

cheers,

Scott
"Paul" wrote:

I need to ascertain the last used cell (actually the last used row and the
last used column) in a protected worksheet.

I have tried specialcells(xlLastCell) but this fails when the sheet is
protected.

Any help appreciated


Paul

Determining last active cell in a protected worksheet
 
Scott

Many thanks - the only thing I had to change was .cells. to just cells.

And yes, I am trying to do this with VBA.

Paul

"Scott" wrote:

Have you tried ctrl-end? Unless you're doing it through VBA. Then you can
always try
myLastRow = _
.Cells.Find("*", After:=.Cells(1), _
LookIn:=xlFormulas, LookAt:=xlWhole, _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row
myLastCol = _
.Cells.Find("*", After:=.Cells(1), _
LookIn:=xlFormulas, LookAt:=xlWhole, _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByColumns).Column

cheers,

Scott
"Paul" wrote:

I need to ascertain the last used cell (actually the last used row and the
last used column) in a protected worksheet.

I have tried specialcells(xlLastCell) but this fails when the sheet is
protected.

Any help appreciated



All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com