Prev Previous Post   Next Post Next
  #1   Report Post  
aftamath
 
Posts: n/a
Default Date Code

Here is my code that I'm having a problem with. I want the programming to
start evaluating from cell I2 through the rest of the column. Is there a
different way to write the code. Well the workbook opens, I get a message
that says 'Type Mismatch' and highlights the boolean section of the if
statement.

Private Sub Workbook_Open()

Dim Target As Range

Application.Workbooks(1).Worksheets(5).Activate

ActiveSheet.Range("I2").Select

For Each Target In Range("I2:I20")

If Target.Value < "" And DateValue(Target.Value) - DateValue(Now) <= 2
And DateValue(Target.Value) - DateValue(Now) 0 And Target.Offset
_(columnoffset:=-1).Value = "" Then
MsgBox "Order Due" & " " & Target.Offset(columnoffset:=-7).Value
End If

Next Target

End Sub

 
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
converting text in cell to a date time Herman Excel Worksheet Functions 3 October 22nd 05 07:18 PM
Recurring annual events using a specific date as a trigger date Bamboozled Excel Worksheet Functions 1 June 6th 05 01:44 PM
extract date from the most current date Cali00 Excel Discussion (Misc queries) 1 April 13th 05 02:05 PM
Date issue between Windows and Macintosh version dlg1967 Excel Discussion (Misc queries) 4 January 19th 05 03:51 PM
Problem with Date format from VBA code twig Excel Discussion (Misc queries) 3 December 7th 04 06:01 PM


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