Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date question
I want to put a text box which suggests the year.
I would like it to suggest the current year until after july when the program will need to suggest next year. Thanks in advance Greg |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date question
Hi Greg
like this? ------- Private Sub UserForm_Initialize() If Month(Now()) <= 7 Then Me.TextBox1.Value = Year(Now()) Else Me.TextBox1.Value = Year(Now()) + 1 End If End Sub -------- Cheers JulieD "Greg B" wrote in message ... I want to put a text box which suggests the year. I would like it to suggest the current year until after july when the program will need to suggest next year. Thanks in advance Greg |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date question
Try somehting like:
=IF(MONTH(TODAY())<8,YEAR(TODAY()),YEAR(TODAY())+1 ) -or- If Month(Now) < 8 Then Text1 = Year(Now) Else Text1 = Year(Now) + 1 End If "Greg B" wrote: I want to put a text box which suggests the year. I would like it to suggest the current year until after july when the program will need to suggest next year. Thanks in advance Greg |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date question
Thank you
Didn't think of doing it that way Greg |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date question
you're welcome and thanks for the feedback
"Greg B" wrote in message ... Thank you Didn't think of doing it that way Greg |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date question
How about shortening it?
Private Sub UserForm_Initialize() Me.TextBox1.Value = Year(Date)-1*(Month(Date)6) End Sub -- HTH RP (remove nothere from the email address if mailing direct) "JulieD" wrote in message ... Hi Greg like this? ------- Private Sub UserForm_Initialize() If Month(Now()) <= 7 Then Me.TextBox1.Value = Year(Now()) Else Me.TextBox1.Value = Year(Now()) + 1 End If End Sub -------- Cheers JulieD "Greg B" wrote in message ... I want to put a text box which suggests the year. I would like it to suggest the current year until after july when the program will need to suggest next year. Thanks in advance Greg |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date question
Hi it is saying run time error - invalid argument
What am I not doing. I wrote back without running the macro. Sorry to bother you again Greg |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date question
replace
textbox1 with whatever you named your textbox Cheers JulieD "Greg B" wrote in message ... Hi it is saying run time error - invalid argument What am I not doing. I wrote back without running the macro. Sorry to bother you again Greg |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date question
Hi Greg,
Struggling to know, as it works in my test. What does this bit mean? ... I wrote back without running the macro. -- HTH RP (remove nothere from the email address if mailing direct) "Greg B" wrote in message ... Hi it is saying run time error - invalid argument What am I not doing. I wrote back without running the macro. Sorry to bother you again Greg |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date question
It is ok I have worked it out
Thanks for the help Greg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Date question | Excel Worksheet Functions | |||
Date question | Excel Worksheet Functions | |||
Date Question | Excel Discussion (Misc queries) | |||
Date Question | Excel Worksheet Functions | |||
Date question | Excel Programming |