View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default VBA for Last Cell in Formula Range

One way:

On Error Resume Next
With Sh.Cells.SpecialCells(xlCellTypeFormulas)
With .Areas(.Areas.Count)
Set rge = .Cells(.Count)
End With
End With
On Error GoTo 0
If Not rge Is Nothing Then MsgBox rge.Address



In article .com,
wrote:

Using VBA
Trying to indentify the last cell on sheet that has a formula.

code fragment below

have tried
Set rge = Sh.UsedRange.SpecialCells(xlCellTypeFormulas,
xlCellTypeLastCell)
msgbox rge.Address

However I this returns the address of all formula cells

Any suggestions to get the address of the last cell with a formula ?

ie used range a1: j 100 , and last formula may be j 89