LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Find the Sunday with min value

Thanks, Bob. I'm getting a Compile Error when I test this code. It tells me
that a function call on the left side of an equation must return a variant or
an object.
--
tj


"Bob Phillips" wrote:

This works for me

iCol = fst.Column
Set rng = Range(fst.Address, Cells(Rows.Count, iCol).End(xlUp))
val = Evaluate("MATCH(MIN(IF(WEEKDAY(" & fst.Address & ")=1," &
fst.Address & "))," & fst.Address & "0)")
Set DMin = fst(val)


--
HTH

Bob Phillips

"tjtjjtjt" wrote in message
...
I am looking in a range of dates to find the minimum date. Once it is

found,
I will find what weekday it is. If it isn't a Sunday, I go to the smallest
Sunday larger than the Minimum date to set the starting point for my code.

I have everything working, except I can't seem to transfer the cell with

the
minimum date to a range variable.

This was my latest attempt:
Set rng = Range(fst.Address & ":A" & Cells(Rows.Count, "A").End(xlUp).Row)
Set dmin = rng.Find(Application.WorksheetFunction.Min(rng))

dmin is always set to Nothing.

What do I need to do to set dmin as the cell containing the minimum date?

Also, since it is possible that "fst" may not be in column A, is there a
more flexible way to set my "rng" variable?

Thanks,
--
tj




 
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
Find last Sunday Dean F Excel Worksheet Functions 5 April 7th 23 12:16 PM
Sunday Dale[_4_] Excel Worksheet Functions 8 November 7th 12 09:27 AM
Sunday Function Sunday Function Excel Worksheet Functions 3 June 7th 06 08:12 AM
Help with looking the nearest Sunday JR Excel Worksheet Functions 6 April 11th 06 03:02 AM
Find the first Sunday for a given year? Eutrapelia Excel Worksheet Functions 2 January 20th 06 06:07 PM


All times are GMT +1. The time now is 06:15 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"