View Single Post
  #4   Report Post  
David McRitchie
 
Posts: n/a
Default

I think you should reconsider what you are doing, but with the
information provided you appear to want the cell below the
last constant in Column A. The following will do that.

Sub afterlastconstant()
Dim rng As Range, L As Long, M As Long
Set rng = Columns("A:A").SpecialCells(xlCellTypeConstants, 23)
L = rng.Areas.Count
M = rng(L).Count
rng.Areas(L).Item(M).Offset(1, 0).Select
End Sub

The above solution has no loops, so should run very fast.
there is problem with Special cells with over 8,192 non-contiguous cells
in other words more than 4096 separate areas of contiguous constants,
which you are much more likely to encounter if you have alternate rows of data..

Another solution offered is dependent on there always being 65536 rows
since that number has changed in the past and may change again it should
not be a constant cells.rows.count should be used instead of 65536
http://www.mvps.org/dmcritchie/excel...ars.htm#macros
In any case it is the wrong solution for this thread, since cells with formulas
are definitely not empty and cell A100 has a formula.

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"zhj23" wrote in message ...
I have given a range (say a1.a100 which contain IF function in every cell) to
my users. They are to enter value into the cell everyday continuously.

Can anyone help me with VBA codes for me to pick up the last entered value
(say A42, A43 onwards are still empty) on anyday, to be linked to another
workbook?

I used the SpecialCells(xlCellTypeLastCell) feature, it doesn't work. It
always return A100, possibly because A100 contains an IF statement.

Thanks.