Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Excel Macro Nightmares!

Old Jan 14, 2002 | 01:03 PM
  #1  
BigGT3Fan's Avatar
BigGT3Fan
Thread Starter
Scooby Regular
 
Joined: Jul 2001
Posts: 464
Likes: 0
Post

Want to do something really simple:

Given a date, determine what day of the week it is.

Does VBA have a DayOf Week (dToday) type function, 'cos I can't find it!!!! [img]images/smilies/mad.gif[/img]

TIA,




Alex
Reply
Old Jan 14, 2002 | 01:20 PM
  #2  
Martingb's Avatar
Martingb
Scooby Regular
 
Joined: Oct 2001
Posts: 65
Likes: 0
Post

Alex,

Use the WEEKDAY(<Date&gt function. This will return a code of 1 for Sunday, 2 for Monday, etc. More info is in the help file.

Martin.
Reply
Old Jan 14, 2002 | 02:28 PM
  #3  
sasim's Avatar
sasim
Used to work here!!
 
Joined: Jun 2000
Posts: 1,488
Likes: 0
From: Peterhead, Scotland
Post

You can convert this number to the day (Monday, Tuesday etc) by using the IF function, you can nest up to 7 IF functions together, so ideal for day of the week (you only need 6)

=if(weekday(DATE))=1,"Monday",if(weekday(DATE))=2, "Tuesday"......,"Saturday"))

Drop me an E-Mail if you need to know exactly how to do it.

Stuart




Reply
Old Jan 14, 2002 | 02:32 PM
  #4  
BigGT3Fan's Avatar
BigGT3Fan
Thread Starter
Scooby Regular
 
Joined: Jul 2001
Posts: 464
Likes: 0
Post


Thanks,

I just needed to know if it was a weekend, i.e. =1 or =7.

Next thing to do is add a 'button' or similar to a worksheet such that I can fire an event when a user clicks on it.

Any ideas?




Alex
Reply
Old Jan 14, 2002 | 03:51 PM
  #5  
BigGT3Fan's Avatar
BigGT3Fan
Thread Starter
Scooby Regular
 
Joined: Jul 2001
Posts: 464
Likes: 0
Post

Sorted it.

Thanks anyway



Alex
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Mattybr5@MB Developments
Full Cars Breaking For Spares
28
Dec 28, 2015 11:07 PM
Mattybr5@MB Developments
Full Cars Breaking For Spares
12
Nov 18, 2015 07:03 AM
leg200
Subaru Parts
5
Oct 7, 2015 07:31 AM
has-scooby
Subaru Parts
4
Oct 6, 2015 03:47 PM
bluebullet29
General Technical
9
Oct 5, 2015 02:17 PM


Thread Tools
Search this Thread

All times are GMT +1. The time now is 11:50 PM.