![]() |
Last cell with constant in a sheet
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 |
Last cell with constant in a sheet
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) "Raj" wrote 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 |
Last cell with constant in a sheet
On Feb 13, 5:36 am, Raj wrote:
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 |
Last cell with constant in a sheet
On Feb 13, 5:36 am, Raj wrote:
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 |
Last cell with constant in a sheet
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 -- Gary''s Student - gsnu200768 "Raj" wrote: 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 |
All times are GMT +1. The time now is 10:45 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com