View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
David Gerstman David Gerstman is offline
external usenet poster
 
Posts: 57
Default xldown in a non-contiguous column

This is what I did:

Sub check_names()

Dim ws_name As String

ws_name = "ACTIVE"

Worksheets(ws_name).Activate

Set poc_range = ActiveSheet.Cells(Rows.Count, 2).End(xlUp)

ind = 1

For Each poc In poc_range

ind = ind + 1

Next poc

MsgBox "There were " & ind & " entries."

End Sub

After it ran, ind equalled 2 and not 52. What did I do wrong?

"Tom Ogilvy" wrote:

Why not try it.

--
regards,
Tom Ogilvy



"David Gerstman" wrote:

whoops, I worded that wrong. I want to get to the end of the data. Not the
end of h of the column!

"Jim Thomlinson" wrote:

You bet. xlUp... try this...

dim rng as range
set rng = Sheets("Sheet1").Cells(rows.count, "A").end(xlUp)
msgbox rng.address

--
HTH...

Jim Thomlinson


"David Gerstman" wrote:

I have a non-contiguous column that I need to read. xldown will only take me
to the first blan row. Is there an alternative to xldown to get to the real
bottom of the column?