|
-
Dec 24th, 2009, 09:43 PM
#1
Thread Starter
Member
[RESOLVED] calendar/ date reference question
hey all, I'm new here... been searching far and wide for what seems like should be simple. I am a glass blower- not a programmer- but I'm working on learning vba at the moment working on a basic calendar/ to do type application in Excel 2003... on windows xp... and I'm stuck.
So I've found a number of ways to do calendars- but I'm making one that is linear i.e. just goes left to right... any suggestions on that would be appreciated. I did make one but I'm sure there is a better way then I did it.
The main thing I need- why I'm posting- is simply this: I need to reference the year in a date in a cell.... that's all.. just look at the date and say what year it is so that I can then color the different years differently. This isn't that hard is it? I've been able to find different things in code that are close but they're essentially either referencing ONE date (i.e. a start date) or they system date... how do I tell the code to look at any random cell with a date in it and capture the year so as to use that as a reference further??
Thanks for any help!
-
Dec 25th, 2009, 08:56 AM
#2
Re: calendar/ date reference question
Kind of hard to answer without knowing what you mean by 'cell', but
this may help:
Code:
Text1.Text = Now 'assign current date/time to textbox
Debug.Print Year(Text1.Text)
Debug.Print Month(Text1.Text)
Debug.Print Day(Text1.Text)
Debug.Print Hour(Text1.Text)
Debug.Print Minute(Text1.Text)
Debug.Print Second(Text1.Text)
-
Dec 25th, 2009, 03:18 PM
#3
Thread Starter
Member
Re: calendar/ date reference question
Well I appreciate the response... but...
Are you serious? You don't know what a CELL is?? Is my question that unclear?
I'm working Excel 2003 on Windows XP using the Visual Basic Editor. Am I on the wrong forum? I thought this was a forum for Visual Basic that I can use.... the program Excel is based on CELLS you gotta know what I'm talking about whether you program or not, most novices have at least USED Excel and understand what a "cell" is.......
Can someone at least just tell me what forum to go to? If you guys don't know what a cell is I'm obviously in the wrong place... that's like a runner not knowing what a shoe is. I'm just using the Visual Basic part of Excel 2003 to program a simple application based in Excel... is this really so alien to you guys??
*Baffled*
Last edited by fumalicious; Dec 25th, 2009 at 03:43 PM.
-
Dec 25th, 2009, 10:06 PM
#4
Re: calendar/ date reference question
Welcome to VBForums.com 
I'm just using the Visual Basic part of Excel 2003 to program a simple application based in Excel
That is VBA not VB6.. 
Your question should be posted in this forum: Office Development (includes VBA)
I will inform the moderators, so that they will move this Thread....
I thought this was a forum for Visual Basic that I can use....
Here, you can post VB5 or VB6 related questions...
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Dec 26th, 2009, 02:42 AM
#5
Thread Starter
Member
Re: calendar/ date reference question
-
Dec 27th, 2009, 01:07 PM
#6
Re: calendar/ date reference question
Thread moved to 'Office Development/VBA' forum (note that the "VB Editor" in Office programs is actually VBA rather than VB, so the 'VB6' forum is not really apt)
This may work for you:
Code:
MsgBox Year(Sheet1.Range("A1").Value)
-
Dec 29th, 2009, 01:40 AM
#7
Thread Starter
Member
Re: calendar/ date reference question
fantastic! (didn't need the message box.. and worked perfect) thanks for the help, really appreciate it! Now back to the rest of the puzzles to figure out!
-
Dec 29th, 2009, 01:12 PM
#8
Re: calendar/ date reference question
As you now have it sorted out, could you please do us a little favour, and mark the thread as Resolved?
(this saves time reading for those of us who like to answer questions, and also helps those who search to find answers)
You can do it by clicking on "Thread tools" just above the first post in this thread, then "Mark thread resolved". (like various other features of this site, you need JavaScript enabled in your browser for this to work).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|