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!

Thread Tools
 
Search this Thread
 
Old 14 January 2002, 01:03 PM
  #1  
BigGT3Fan
Scooby Regular
Thread Starter
 
BigGT3Fan's Avatar
 
Join Date: Jul 2001
Posts: 464
Likes: 0
Received 0 Likes on 0 Posts
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
Old 14 January 2002, 01:20 PM
  #2  
Martingb
Scooby Regular
 
Martingb's Avatar
 
Join Date: Oct 2001
Posts: 65
Likes: 0
Received 0 Likes on 0 Posts
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.
Old 14 January 2002, 02:28 PM
  #3  
sasim
Used to work here!!
 
sasim's Avatar
 
Join Date: Jun 2000
Location: Peterhead, Scotland
Posts: 1,488
Likes: 0
Received 0 Likes on 0 Posts
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




Old 14 January 2002, 02:32 PM
  #4  
BigGT3Fan
Scooby Regular
Thread Starter
 
BigGT3Fan's Avatar
 
Join Date: Jul 2001
Posts: 464
Likes: 0
Received 0 Likes on 0 Posts
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
Old 14 January 2002, 03:51 PM
  #5  
BigGT3Fan
Scooby Regular
Thread Starter
 
BigGT3Fan's Avatar
 
Join Date: Jul 2001
Posts: 464
Likes: 0
Received 0 Likes on 0 Posts
Post

Sorted it.

Thanks anyway



Alex
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Mattybr5@MB Developments
Full Cars Breaking For Spares
28
28 December 2015 11:07 PM
Mattybr5@MB Developments
Full Cars Breaking For Spares
12
18 November 2015 07:03 AM
leg200
Subaru Parts
5
07 October 2015 07:31 AM
has-scooby
Subaru Parts
4
06 October 2015 03:47 PM
bluebullet29
General Technical
9
05 October 2015 02:17 PM



Quick Reply: Excel Macro Nightmares!



All times are GMT +1. The time now is 04:12 PM.