hello
i was trying to use johnske's article about finding the last row in a sheet containing formula using find or special cells methods.
is there another way to find the last cell in a sheet with a formula?
thanks
hello
i was trying to use johnske's article about finding the last row in a sheet containing formula using find or special cells methods.
is there another way to find the last cell in a sheet with a formula?
thanks
moshe
Why do you not want to use that method? The alternative is a long-winded check on every cell.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
how do you fell about:
[VBA]
Cells.SpecialCells(xlCellTypeFormulas, xlCellTypeLastCell).Activate
[/VBA]
moshe
What do you mean? I have no feelings apart from it doesn't do what you asked originally.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
hello
i found this two macros in johnske article.they both return the same result.why?
[VBA]
Sub Find_LastRowxlValues()
On Error GoTo Finish
MsgBox "Last row is row " & Cells.Find("*", _
SearchOrder:=xlByRows, LookIn:=xlValues, _
SearchDirection:=xlPrevious).EntireRow.row
Exit Sub
Finish:
MsgBox "No values found"
End Sub
Sub Find_LastRowxlFormulas()
On Error GoTo Finish
MsgBox "Last row is-" & Cells.Find("*", _
SearchOrder:=xlByRows, LookIn:=xlFormulas, _
SearchDirection:=xlPrevious).EntireRow.row, vbExclamation, "last cell with a 4mula:"
Exit Sub
Finish:
MsgBox "No formulas or values found - " & err.number
End Sub
[/VBA]
should'nt be any difference between a cell with a constant and a cell with a formula?what is ther lookin suppose to do?
thanks
moshe
my solution:
[VBA]
On Error GoTo Finish
MsgBox "Last formula row is-" & Cells.Find("=", _
SearchOrder:=xlByRows, LookIn:=xlFormulas, _
SearchDirection:=xlPrevious).EntireRow.row, vbExclamation, "last cell with a 4mula:"
Exit Sub
Finish:
MsgBox "No formulas or values found - " & err.number, vbCritical, "error"
[/VBA]
moshe