PC Review


Reply
Thread Tools Rate Thread

COMPARE TODAY WITH DATE IN COLUMN

 
 
=?Utf-8?B?RGFuaWVs?=
Guest
Posts: n/a
 
      26th Jun 2007
I want to compare today date with date in a column (column name:
"date_last_op") and fill the bar chart with pattern if > 3 days but alway
have error at
Set Rng2.Value = (DateDiff(TODAY, "date_last_op", "d"))

Don't know how to fix. Need your help. Please respond with your sugestion
thanks
Daniel

------------------------------------

DIM Rng2 As range
DIM Cnt2 AS interger
DIM S AS interger

For Each Rng2 In Range(.Cells(2, 6), .Cells(r, 6))

Set Pts = ActiveChart.SeriesCollection(1).Points(Cnt2)

Set Rng2.Value = (DateDiff(TODAY, "date_last_op", "d"))


If Rng2.Value > 3 Then


Pts.Fill.Patterned Pattern:=msoPatternLightUpwardDiagonal

End If
Cnt2 = Cnt2 + 1
Next Rng2



 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      26th Jun 2007
>I want to compare today date with date in a column (column name:
> "date_last_op") and fill the bar chart with pattern if > 3 days but alway
> have error at
> Set Rng2.Value = (DateDiff(TODAY, "date_last_op", "d"))
>
> Don't know how to fix. Need your help. Please respond with your sugestion


You are trying to use Excel worksheet function ordering on the VBA DateDiff
function... they are not the same... as well as a worksheet function (TODAY)
which doesn't exist in VBA The first argument in DateDiff is the Interval,
then the start (lowest) date, followed by the end (highest) date. Also,
TODAY does not exist in VBA... use either Date (which returns today's date
only) or Now (which returns today's date and time).

Rick

 
Reply With Quote
 
=?Utf-8?B?RGFuaWVs?=
Guest
Posts: n/a
 
      26th Jun 2007
Thanks Rick
I should use date is good enough.
Another question:
How can I reset the function

Interior.ColorIndex

to begin color my bar chart again?
Thanks
Daniel

"Rick Rothstein (MVP - VB)" wrote:

> >I want to compare today date with date in a column (column name:
> > "date_last_op") and fill the bar chart with pattern if > 3 days but alway
> > have error at
> > Set Rng2.Value = (DateDiff(TODAY, "date_last_op", "d"))
> >
> > Don't know how to fix. Need your help. Please respond with your sugestion

>
> You are trying to use Excel worksheet function ordering on the VBA DateDiff
> function... they are not the same... as well as a worksheet function (TODAY)
> which doesn't exist in VBA The first argument in DateDiff is the Interval,
> then the start (lowest) date, followed by the end (highest) date. Also,
> TODAY does not exist in VBA... use either Date (which returns today's date
> only) or Now (which returns today's date and time).
>
> Rick
>
>

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      26th Jun 2007
You will need to post a separate question about that (I think this one will
get lost within this thread) as I have not dealt with charting in VBA
before... my post in this thread was simply a syntax comment.

Rick


"Daniel" <(E-Mail Removed)> wrote in message
news:FE92536D-C9FA-4D4C-A790-(E-Mail Removed)...
> Thanks Rick
> I should use date is good enough.
> Another question:
> How can I reset the function
>
> Interior.ColorIndex
>
> to begin color my bar chart again?
> Thanks
> Daniel
>
> "Rick Rothstein (MVP - VB)" wrote:
>
>> >I want to compare today date with date in a column (column name:
>> > "date_last_op") and fill the bar chart with pattern if > 3 days but
>> > alway
>> > have error at
>> > Set Rng2.Value = (DateDiff(TODAY, "date_last_op", "d"))
>> >
>> > Don't know how to fix. Need your help. Please respond with your
>> > sugestion

>>
>> You are trying to use Excel worksheet function ordering on the VBA
>> DateDiff
>> function... they are not the same... as well as a worksheet function
>> (TODAY)
>> which doesn't exist in VBA The first argument in DateDiff is the
>> Interval,
>> then the start (lowest) date, followed by the end (highest) date. Also,
>> TODAY does not exist in VBA... use either Date (which returns today's
>> date
>> only) or Now (which returns today's date and time).
>>
>> Rick
>>
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare TextBox date to today David C Microsoft ASP .NET 3 31st Mar 2009 01:30 PM
Need the formula or macro. If i enter today date in the cell (Row 1,Column 2) and on tab out, the column 1 cell should be filled with "corresponding Day" of the date kakasay Microsoft Excel Misc 0 22nd Jan 2007 12:22 PM
Compare date, when date is today, change other fields =?Utf-8?B?VHhWaWNz?= Microsoft Access 1 30th Jun 2006 11:51 PM
How to compare today's date to a cell on VBA? Sivangen Microsoft Excel Programming 4 4th Jun 2006 12:30 PM
Compare date field to today's date =?Utf-8?B?R3J5em9y?= Microsoft Access 2 12th Nov 2004 02:48 PM


Features
 

Advertising
 

Newsgroups
 


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