Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 354
Default COMPARE TODAY WITH DATE IN COLUMN

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default COMPARE TODAY WITH DATE IN COLUMN

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 354
Default COMPARE TODAY WITH DATE IN COLUMN

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default COMPARE TODAY WITH DATE IN COLUMN

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" wrote in message
...
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
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
IF TODAY equals date in cell A10, or if TODAY is beyond that date SoupNazi Excel Worksheet Functions 4 April 23rd 07 01:14 AM
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 Excel Discussion (Misc queries) 1 January 22nd 07 12:31 PM
Need 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 Excel Discussion (Misc queries) 1 January 22nd 07 12:31 PM
compare date to column data Custermd Excel Worksheet Functions 1 February 21st 06 03:57 PM
Lookup and compare to (today) + time and get result matteo Excel Discussion (Misc queries) 0 June 16th 05 07:43 PM


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