Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default week function in vba?

I don't know if one exists or not, but is there a function in VBA that would
return a number representing the week of the year (0-51, or 1-52) when passed
a date? similar to how year() or day() pulls out the year or day portion of
a given date?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default week function in vba?

Make sure you have the Analysis toolpak addin and use weeknum(now()) to get
current week number
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"badazizi" wrote:

I don't know if one exists or not, but is there a function in VBA that would
return a number representing the week of the year (0-51, or 1-52) when passed
a date? similar to how year() or day() pulls out the year or day portion of
a given date?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default week function in vba?

You would use the DatePart function with "ww" as the 1st argument (with the
date as the 2nd argument). There are optional 3rd and 4th arguments which
can modify how DatePart functions, so you should look this function up in
the help files (type DatePart and then, with the text caret in or next to
the word, hit the F1 key).

Rick


"badazizi" wrote in message
...
I don't know if one exists or not, but is there a function in VBA that
would
return a number representing the week of the year (0-51, or 1-52) when
passed
a date? similar to how year() or day() pulls out the year or day portion
of
a given date?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help required on week function [email protected] Excel Worksheet Functions 5 March 12th 09 03:37 PM
Week vs. Week VBA Function Rob Excel Programming 1 October 27th 06 05:53 PM
Week Number Function gti_jobert[_57_] Excel Programming 5 March 16th 06 09:05 AM
Day of week function needed Metolius Dad Excel Worksheet Functions 5 April 11th 05 05:39 PM
custom function for the day of the week goss[_28_] Excel Programming 3 August 9th 04 12:32 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"