Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default XLUP FInd Error

Hey guys

The below code finds the address of the first occurance of
the specified value (variable). Lets say the variable is
equal to "Mouse". Lets say mouse was located in cell C4,
C100, and C322. When the code is run, test would equal
C322 because cell C322 is the location of the first
instance of that value it sees. This works fine accept
when the variable is equal to a date.

In this case, variable CL.Value = 06/22/2004. When the
below code is run, the result is empty. What do I need to
do to fix this?

test = Range("C65536").End(xlUp).Find(CL.Value).Address
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default XLUP FInd Error

Maybe change to (untested):

test = Range("C65536").End(xlUp).Find(CDate(CL.Value)).Ad dress

to get it to a date. In any case the problem is surely a date vs. tex
comparison issue (or vice-versa).



--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default XLUP FInd Error

If you've shown your exact code in the message, the value you are looking for
is 6 divided by 22 divided by 2004. It's not the date June 22, 2004.

You must specify dates as either the date serial number or a literal date. The
format for the latter is to surround the date with pound signs, e.g.
#8/11/2004#.

Try it with CL.Value = #6/22/2004#

or

CL.Value = DateSerial(2004,6,22)


On Wed, 11 Aug 2004 11:53:49 -0700, "Todd Huttenstine"
wrote:

Hey guys

The below code finds the address of the first occurance of
the specified value (variable). Lets say the variable is
equal to "Mouse". Lets say mouse was located in cell C4,
C100, and C322. When the code is run, test would equal
C322 because cell C322 is the location of the first
instance of that value it sees. This works fine accept
when the variable is equal to a date.

In this case, variable CL.Value = 06/22/2004. When the
below code is run, the result is empty. What do I need to
do to fix this?

test = Range("C65536").End(xlUp).Find(CL.Value).Address


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default XLUP FInd Error

test = Range("C65536").End(xlUp).Find(CL.Value).Address

Are you aware that your code above only searches a single cell ?
I strongly doubt that's really what you're wanting to do.


The code below will search from C1, to the last populated cell in Column C.
It will return the address of the first occurence of CL.Value.
test = Range(Range("C1"), Range("C65536").End(xlUp)).Find(CL.Value).Address


The code below will search for the last occurence of CL.Value.
test = Range(Range("C1"), Range("C65536").End(xlUp)).Find( _
What:=CL.Value, _
After:=Range("C1"), _
SearchDirection:=xlPrevious).Address


Regards,
Vic Eldridge



"Todd Huttenstine" wrote in message ...
Hey guys

The below code finds the address of the first occurance of
the specified value (variable). Lets say the variable is
equal to "Mouse". Lets say mouse was located in cell C4,
C100, and C322. When the code is run, test would equal
C322 because cell C322 is the location of the first
instance of that value it sees. This works fine accept
when the variable is equal to a date.

In this case, variable CL.Value = 06/22/2004. When the
below code is run, the result is empty. What do I need to
do to fix this?

test = Range("C65536").End(xlUp).Find(CL.Value).Address

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
Understanding .End(xlUp) (1,1) Dennis Excel Discussion (Misc queries) 4 April 4th 23 02:13 PM
End(xlUp) question CoolBusiness Excel Discussion (Misc queries) 4 March 26th 09 07:07 PM
Worksheet function that duplicates End(xlUp)? Arlen Excel Discussion (Misc queries) 2 August 2nd 08 06:36 AM
problem with .end(xlUp).row [email protected] Excel Discussion (Misc queries) 4 December 29th 06 01:24 PM
ADD Macro - xlup plus xlto right Danny Excel Worksheet Functions 5 March 28th 06 12:08 AM


All times are GMT +1. The time now is 02:39 PM.

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

About Us

"It's about Microsoft Excel"