Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default An old chestnut: finding the last cell in a range

I am trying to find the last occupied cell in a range. I have tried
every different method that I have found in this group and others but
none seem to work for me.

I have a range in which values are copied from another sheet with a
formula like: =IF('Data entry'!A19<"",'Data entry'!A19,"")

This formula will copy the contents of the cell in the 'Data entry'
sheet if it is non-empty, otherwise it will place 'nothing' in the
cell.

My problem is that all of the 'find last occupied cell' routines I
have used refuse to see this cell as being unoccupied.

One thing I have tried is to create a column which has an =IF()
formula in it which counts how many cells have values in a given row
and if it is more than zero then it puts a 'Y' in that row. I then do
a Range.Search on that column to find the last occurance of 'Y'. Even
this won't work! It simply highlights the last cell in that column
with the =IF() formula in it - regardless of whether it has 'Y' in it
or not.

Any help gratefully appreciated.

Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default An old chestnut: finding the last cell in a range

Don't multi post, you have an answer in your other post in worksheet functions

"Mark Hanley" wrote:

I am trying to find the last occupied cell in a range. I have tried
every different method that I have found in this group and others but
none seem to work for me.

I have a range in which values are copied from another sheet with a
formula like: =IF('Data entry'!A19<"",'Data entry'!A19,"")

This formula will copy the contents of the cell in the 'Data entry'
sheet if it is non-empty, otherwise it will place 'nothing' in the
cell.

My problem is that all of the 'find last occupied cell' routines I
have used refuse to see this cell as being unoccupied.

One thing I have tried is to create a column which has an =IF()
formula in it which counts how many cells have values in a given row
and if it is more than zero then it puts a 'Y' in that row. I then do
a Range.Search on that column to find the last occurance of 'Y'. Even
this won't work! It simply highlights the last cell in that column
with the =IF() formula in it - regardless of whether it has 'Y' in it
or not.

Any help gratefully appreciated.

Mark

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default An old chestnut: finding the last cell in a range


hi Mark,

To help us identify the problem, can you please tell us what methods
you have tried (ie post the code)?

Is your data entry typed in, or is it copy & pasted from elsewhere (eg
a webpage)?

What results do you get for each of the below formulae?
=LEN('Data Entry'!A19)
=ISBLANK('Data Entry'!A19)
=CHAR('Data Entry'!A19)
=CODE('Data Entry'!A19)


hth
Rob


--
broro183

Rob Brockett. Always learning & the best way to learn is to
experience...
------------------------------------------------------------------------
broro183's Profile: http://www.thecodecage.com/forumz/member.php?userid=333
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=140972

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default An old chestnut: finding the last cell in a range

Select the range
To get the location, run WhereIsIt
To get the value, run WhatIsIt

Sub WhereIsIt()
Dim r As Range, rr As Range
Dim addy As String
addy = ""
Set r = Selection
For Each rr In r
If IsEmpty(rr) Then
Else
addy = rr.Address
End If
Next
MsgBox addy
End Sub


Sub WhatIsIt()
Dim r As Range, rr As Range
Dim valu As String
valu = ""
Set r = Selection
For Each rr In r
If IsEmpty(rr) Then
Else
valu = rr.Value
End If
Next
MsgBox valu
End Sub

--
Gary''s Student
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default An old chestnut: finding the last cell in a range

On 4 Oct, 14:26, Mike H wrote:
Don't multi post, you have an answer in your other post in worksheet functions



"Mark Hanley" wrote:
I am trying to find the last occupied cell in a range. I have tried
every different method that I have found in this group and others but
none seem to work for me.


I have a range in which values are copied from another sheet with a
formula like: =IF('Data entry'!A19<"",'Data entry'!A19,"")


This formula will copy the contents of the cell in the 'Data entry'
sheet if it is non-empty, otherwise it will place 'nothing' in the
cell.


My problem is that all of the 'find last occupied cell' routines I
have used refuse to see this cell as being unoccupied.


One thing I have tried is to create a column which has an =IF()
formula in it which counts how many cells have values in a given row
and if it is more than zero then it puts a 'Y' in that row. I then do
a Range.Search on that column to find the last occurance of 'Y'. Even
this won't work! It simply highlights the last cell in that column
with the =IF() formula in it - regardless of whether it has 'Y' in it
or not.


Any help gratefully appreciated.


Mark


Actually I didn't multi-post. I created two separate posts (albeit
with *almost* identical content).

I posted a very similar message to this group after I found it and
considered that it was more suited to my problem. By the time I had
finished the post to this group I had received replies from the other
group.

As it is, I found a solution that worked from the formulas group:
http://groups.google.co.uk/group/mic...5adaad0?hl=en#

Thank you to everybody who took the time to reply.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default An old chestnut: finding the last cell in a range

That is multi-posting..............two separate posts with same subject
matter.

Maybe you are thinking you did not "cross-post", which is true.

Crossposting is preferred to multi-posting.

Those of us using real news readers can deal with cross-posting by simply
not downloading more than one copy of a cross-post.


Gord Dibben MS Excel MVP

On Sun, 4 Oct 2009 08:17:24 -0700 (PDT), maninashed
wrote:

Actually I didn't multi-post. I created two separate posts (albeit
with *almost* identical content).


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default An old chestnut: finding the last cell in a range

On Sun, 4 Oct 2009 06:07:06 -0700 (PDT), Mark Hanley
wrote:

I am trying to find the last occupied cell in a range. I have tried
every different method that I have found in this group and others but
none seem to work for me.

I have a range in which values are copied from another sheet with a
formula like: =IF('Data entry'!A19<"",'Data entry'!A19,"")

This formula will copy the contents of the cell in the 'Data entry'
sheet if it is non-empty, otherwise it will place 'nothing' in the
cell.

My problem is that all of the 'find last occupied cell' routines I
have used refuse to see this cell as being unoccupied.

One thing I have tried is to create a column which has an =IF()
formula in it which counts how many cells have values in a given row
and if it is more than zero then it puts a 'Y' in that row. I then do
a Range.Search on that column to find the last occurance of 'Y'. Even
this won't work! It simply highlights the last cell in that column
with the =IF() formula in it - regardless of whether it has 'Y' in it
or not.

Any help gratefully appreciated.

Mark


Something like:

=LOOKUP(2,1/(A:A<""),A:A)

Note that in versions of Excel prior to 2007, you may not be able to reference
the entire row. If that is the case, then:

=LOOKUP(2,1/(A1:A65534<""),A1:A65534)

or similar.
--ron
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default An old chestnut: finding the last cell in a range

Just to add on...

Happy to here that you have found the solution from the responses at
worksheetfunctions; however if you have responded to the answer at
WorksheetFunctions and to this post the confusion could have been avoided..


"Gord Dibben" wrote:

That is multi-posting..............two separate posts with same subject
matter.

Maybe you are thinking you did not "cross-post", which is true.

Crossposting is preferred to multi-posting.

Those of us using real news readers can deal with cross-posting by simply
not downloading more than one copy of a cross-post.


Gord Dibben MS Excel MVP

On Sun, 4 Oct 2009 08:17:24 -0700 (PDT), maninashed
wrote:

Actually I didn't multi-post. I created two separate posts (albeit
with *almost* identical content).



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
An old chestnut: finding the last cell in a range maninashed Excel Worksheet Functions 10 October 4th 09 05:13 PM
The size chestnut. Peter Noneley Excel Discussion (Misc queries) 2 July 17th 09 09:10 AM
Finding Cell Outside Of Range Minitman Excel Worksheet Functions 3 April 15th 08 06:34 AM
Finding the last cell in a range Alex Excel Programming 3 August 10th 04 10:18 PM
Finding if a cell is within a Range [email protected] Excel Programming 2 October 31st 03 09:57 PM


All times are GMT +1. The time now is 06:30 PM.

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"