Macro not consistant

G

grok

I'm using these statements in some macros:
lc = Cells(1, Columns.Count).End(xlToLeft).Column
lr = Cells(Rows.Count, lc).End(xlUp).Row
Range(Cells(1, 1), Cells(lr, lc)).Select

Most of the time they work but some of the time they do not select all the
rows leaving out one or two. Anyone know why?
 
G

grok

Don, do you mean that this fails if my last row is empty on the last column?
That situation can occur. I'm trying to find the last col with anything in
any row and the last row with anything in any col. Sounds confusing but you
probably know what I mean.

If these statements don't do that then how can I fix them?

grok
 
P

PapaDos

Cells(Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row, Cells.Find("*",
[A1], , , xlByColumns, xlPrevious).Column).Select
 
P

PapaDos

Another alternative that works on a completely empty sheet:
activesheet.usedrange.cells(activesheet.usedrange.cells.count).select
 
Top