Find the last row and column of the dirty area

M

MarkS

Hi,
My problem is that if you enter a value in a cell in say row 65,000 and then
delete it excel will still think the sheet goes to row 65,000. I need to know
what row and column Excel thinks the sheet goes to.
I've found lots of ways to get it to find the real answer but nothing on how
to find out what excel thinks it is.

Thanks MarkS
 
J

Jacob Skaria

Try this

'Last row filled in Column A
lngLastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row

'Last col filled in Row1
lngLastCol = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column


If this post helps click Yes
 
J

Jim Cone

Sub ThisIsIt()
Dim rngCorner As Range
Set rngCorner = Cells.SpecialCells(xlCellTypeLastCell)
MsgBox rngCorner.Address
End Sub
--
Jim Cone
Portland, Oregon USA



"MarkS"
<[email protected]>
wrote in message
Hi,
My problem is that if you enter a value in a cell in say row 65,000 and then
delete it excel will still think the sheet goes to row 65,000. I need to know
what row and column Excel thinks the sheet goes to.
I've found lots of ways to get it to find the real answer but nothing on how
to find out what excel thinks it is.
Thanks MarkS
 
F

FSt1

hi
how much space on a sheet that excel "thinks" has been used is called
UsedRange.
Excel records how much space on a sheet has be used and uses this to do a
number of thinks such set the scroll bars, top and side. some times excel
hicups and looses it reference and UsedRange needs to be reset. a relitive
common post. see this sit on how to reset UsedRange if ever needed....
http://www.contextures.com/xlfaqApp.html#Unused

but to see how much space on a sheet that excel "thinks" has be "used", run
the following macro..
sub howmuchspace()
activesheet.UsedRange.select
end sub

this will highlight the space that excel "thinks" has been used.

regards
FSt1
 
R

Rick Rothstein

Or, if the OP needs this information inside his code...

HowMuchSpace = ActiveSheet.UsedRange.Address
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top