+ Reply to Thread
Results 1 to 8 of 8

How to find the dates of the current week

  1. #1
    Registered User
    Join Date
    08-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    How to find the dates of the current week

    Hello All

    I have a table in which the first column contains dates.
    I have to filter this first column, by choosing only the dates of the current week.
    How can I program this through VBA?

    thanks in advance for your help.

    regards
    Uma

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: How to find the dates of the current week

    Hi Uma,

    You have posted your query in Excel formula section and asking the solution in VBA

    You can have a column on the right side of your first column and use formula =weeknum(a1), where a is your first column. Now you can easily filter basis week number of current week. thanks.

    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Registered User
    Join Date
    08-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: How to find the dates of the current week

    Sorry for posting it under wrong title.
    so I need to first get the current week number in my code.
    Then check, for every row, if the week number of the first column is matching with the week number tht i just calculated.
    correct?

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: How to find the dates of the current week

    hi Uma. alternatively in Excel 2007 & above, the filter also contains a Date Filter -> This Week.

    assuming data in A1:A13, code of this recorded is something like:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by benishiryo; 12-26-2012 at 08:29 AM. Reason: additional info

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  5. #5
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: How to find the dates of the current week

    Yes...

    or you can just consider the current cell( date ) and if date is in-between the current week.. for example if current cell 19 Dec then it is not in current week i.e., 24 Dec to 30 Dec but 26 Dec is in between the current week.

    Regards,
    DILIPandey
    <click on below * if this helps>

  6. #6
    Registered User
    Join Date
    08-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: How to find the dates of the current week

    I am using Excel 2010. Please help me to find this date filter.
    On the data ribbon, there is a filter ICON, which i use for filter.
    But where is the "date filter"?

  7. #7
    Registered User
    Join Date
    08-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: How to find the dates of the current week

    For the current week, I need to check if the date is in between 24th and 28th Dec.
    How can i get these start and end dates of the week programatically in VBA?

  8. #8
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: How to find the dates of the current week

    Hi uvaidya,

    Try below code to get Week start and week end dates :-

    Please Login or Register  to view this content.
    w_start is week start
    w_end is week end, as desired by you.


    Regards,
    DILIPandey
    <click on below * if this helps>

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1