LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Improvements to code

The below code works, but is there a better way?

The logic has to allow for 5 single premium deposits to occur on any
contract anniversary. Example if the contract was issued 7/1/2008.
Deposits can be made on any anniversary after 7/1/2008. Therefore 7/1/2008,
7/1/2011, 7/1/2060 are acceptable dates and 7/15/2008, 9/1/2008 ,
11/16/2040 are unacceptable dates.


Sub Worksheet_Change(ByVal Target As Range)
Dim IMonth As Long
Dim IDay As Long

IMonth = Month(shtInput.Range("Issdate"))
IDay = Day(shtInput.Range("issdate"))
If Target.Column = 2 Then
If Month(Target.Value) < IMonth Or Day(Target.Value) < IDay Then
Target.Value = DateSerial(Year(Target.Value), IMonth, IDay)
MsgBox ("single premium deposits are required to be on anniveries")
End If
End If

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
Code Improvements Larry Excel Programming 6 September 26th 06 07:29 PM
Counting Consecutive Improvements SteveC Excel Discussion (Misc queries) 0 June 13th 06 01:35 AM
Performance Improvements while using RTD [email protected] Excel Programming 12 December 19th 05 12:10 PM
Message Box Improvements Phil Hageman[_4_] Excel Programming 3 June 17th 05 05:34 PM
ListView to Excel Code (but needs SPEED improvements) SVD Excel Programming 1 February 2nd 04 10:54 AM


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