Ignoring Blank Cells in a range
Cells with formulas aren't empty.
One way around it is to use something like:
Dim LastRow As Long
Dim LastCol As Long
With ActiveSheet
LastRow =
..Evaluate("=LOOKUP(2,1/($a$1:$a$65535<""""),ROW($a$1:$a$65535))")
LastCol = .Evaluate("=LOOKUP(1,1/($1:$1<""""),COLUMN($1:$1))")
'then use those two variables where you want them.
.cells(lastrow,lastcol).value =....
end with
I use column A and row 1 in my code. Change it/them to the column/row you want.
BigH wrote:
Hi There,
I have formulas going from a2:a1000, when the value (Part Number)equals zero
or N/A the cell remains blank. I then sort the data so that the values show
starting from a2 down to where ever.
I am looking for code that shows me the last cell with a value in it,
basically the cells maybe blank however they still have a formula in them.
When I run the code below it still goes to the end even if the cells are
blank.
Dim LastCell as Range
set LastCell = Range("A1").End(xlDown)
'assuminmg there are no embedded blank cells
set LastCell = Range("A" & Rows.Count).End(xlUp)
cell.select
TIA BigH
--
Dave Peterson
|