Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default xldown in a non-contiguous column

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default xldown in a non-contiguous column

xlup

Set rng = cells(rows.count,1).End(xlup)

--
Regards,
Tom Ogilvy


"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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default xldown in a non-contiguous column

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?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default xldown in a non-contiguous column

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?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default xldown in a non-contiguous column

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?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default xldown in a non-contiguous column

Ok... I'm lost. The code posted by Tom and I looks up from the bottom of the
sheet and finds the first non-blank cell in a column. I would have assumed
that would be the end of the data... What exactly are you looking for???
--
HTH...

Jim Thomlinson


"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?

  #7   Report Post  
Posted to microsoft.public.excel.programming
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?

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default xldown in a non-contiguous column

OK,
I see what I did wrong. I wanted a range that started at the top and went to
the last row of data. I should have specified that.

I fixed my code to:

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

That did the trick.

"Jim Thomlinson" wrote:

Ok... I'm lost. The code posted by Tom and I looks up from the bottom of the
sheet and finds the first non-blank cell in a column. I would have assumed
that would be the end of the data... What exactly are you looking for???
--
HTH...

Jim Thomlinson


"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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Summing Contiguous Values in a Column? Confused_in_Houston[_2_] Excel Discussion (Misc queries) 6 March 12th 10 09:51 AM
add all contiguous numbers-column-row Bernard Liengme New Users to Excel 0 May 2nd 06 02:02 PM
Go to the next blank row in a column (xlDown) tomwashere2 Excel Programming 1 September 1st 05 05:54 AM
change the 8th column in a not contiguous array Spencer Hutton Excel Programming 5 March 20th 05 04:37 PM
Contiguous Column Selection using variables Leslie Payne Excel Programming 3 October 14th 04 04:08 PM


All times are GMT +1. The time now is 10:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"