Last cell with constant in a sheet

R

Raj

Hi,

I am looking for code for finding the last cell with a constant in it
(the cell in the lowest row and the rightmost column of the range
displayed in Edit-->Go to-->Special-->Constants.)

Thanks in advance for the help.

Regards,
Raj
 
J

Jim Cone

Which of these, for instance, would be the last cell...
C1223 or M1221
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



in message
Hi,
I am looking for code for finding the last cell with a constant in it
(the cell in the lowest row and the rightmost column of the range
displayed in Edit-->Go to-->Special-->Constants.)
Thanks in advance for the help.
Regards,
Raj
 
R

Raj

Hi,

I am looking for code for finding the last cell with a constant in it
(the cell in the lowest row and the rightmost column of the range
displayed in Edit-->Go to-->Special-->Constants.)

Thanks in advance for the help.

Regards,
Raj

Hi,

I could write the code to accomplish this:
Sub selectlastconstant()
Dim rsprange As Range
Set rsprange = Range("a1").SpecialCells(xlCellTypeConstants, 23)
For Each rspcell In rsprange
If rspcell.Row > rsprowtrack Then rsprowtrack = rspcell.Row
If rspcell.Column > rspcoltrack Then rspcoltrack = rspcell.Column
Cells(rsprowtrack, rspcoltrack).Select
Next
End Sub

I look forward to comments on this code like drawbacks, limitations,
etc

Thanks,
Raj
 
R

Raj

Hi,

I am looking for code for finding the last cell with a constant in it
(the cell in the lowest row and the rightmost column of the range
displayed in Edit-->Go to-->Special-->Constants.)

Thanks in advance for the help.

Regards,
Raj

Hi,

I could write the code to accomplish this:

Sub selectlastconstant()
Dim rsprange As Range
Set rsprange = Range("a1").SpecialCells(xlCellTypeConstants, 23)
For Each rspcell In rsprange
If rspcell.Row > rsprowtrack Then rsprowtrack = rspcell.Row
If rspcell.Column > rspcoltrack Then rspcoltrack = rspcell.Column
Cells(rsprowtrack, rspcoltrack).Select
Next
End Sub

Comments/Criticism welcome.

Thanks,
Raj
 
G

Gary''s Student

Either loop over a SpecialCells range or:

Sub getolast()
For Each r In ActiveSheet.UsedRange
If IsEmpty(r) Or r.HasFormula Then
Else
Set rr = r
End If
Next
If rr Is Nothing Then
Else
rr.Select
End If
End Sub
 

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