View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Duncan[_5_] Duncan[_5_] is offline
external usenet poster
 
Posts: 290
Default Easy Declare Variable

Hi All,

I just want to add a variable to my form but want to find out if there
is an easy way first.

Basically I want to define a variable based on the date in a date
picker, lets call it "Grant Year". Now the "Grant Years" run from
August to July,

a start date of 1st August 2005 would be in the 05/06 grant year, as
would be any start date after 1st August 2005 and before 31st July
2006, then 1st August 2006 would be 06/07 Grant Year and so on.

I dont want to declare the variable for every year, is there an easier
way to declare it based on day/month/year so that I dont have to cover
all years manually?

(I.e i dont want to have to do this below)

if dtpicker1.value = "01/08/2005" and dtpicker1.value <= "31/07/06"
then
Variable1 = "05/06 Grant Year"
end if

if dtpicker1.value = "01/08/2006" and dtpicker1.value <= "31/07/07"
then
Variable1 = "06/07 Grant Year"
end if

and so on and so on until infinity

Hope this is possible, if not I will have to do it the long way!

Many thanks

Duncan