Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I seem to always be having problems with Dates for some reason.
The below code. The followong finds the Value in Column A(rngfound) Then in rngfound.offset(0,3) i have a DATE (say" 23 March 2007) Then is rngfound.offset(0,5) i have a numerical value (Representing an Amount of Years) I want the code below to (At HIGHLIGHTED LINE) to ADD the Number of years(rngfound.offset(0,5)) to the DATE (rngfound.offset(0,3), to THUS give me an EXIRY Date. IF this DATE is LESS that(<=) to TODAY's Date then the MSGBOX Appears. If the Date is Greater then to Skip the MSGBOX. Private Sub CommandButton1_Click() Application.ScreenUpdating = False Dim rngFound As Range On Error Resume Next With Worksheets("Data").Range("A:A") Set rngFound = .Find(What:=Me.ComboBox1.Value, After:=.Cells(1), LookIn:=xlValues, LookAt:=xlWhole, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, Matchbyte:=False) If Now <= rngFound.Offset(0, 3).Value + rngFound.Offset(0, 5) * "365.25" Then ' <=== HERE ' If Expired then WARNING Message MsgBox "The [ " & rngFound.Offset(0, 5) & " ] Warranty Period has Expired." & vbCrLf & vbCrLf & _ "Any Services carried out Should be Charged to [ " & rngFound.Offset(0, 2) & " ].", vbInformation Application.ScreenUpdating = True Exit Sub Else 'If Expiry Date is Not yet, then Carry on End If End With UserForm3.Show Unload Me Application.ScreenUpdating = True End Sub What am i doing wrong, as i get the MSGBOX even though i set the Date to Tomorrow's date to expire ? Corey.... |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Between dates. Two problems | Excel Discussion (Misc queries) | |||
Problems with using 2008 in dates | Excel Discussion (Misc queries) | |||
Problems with dates? | Excel Discussion (Misc queries) | |||
problems with dates | Excel Discussion (Misc queries) | |||
problems with dates before 1900 | Excel Programming |