+ Reply to Thread
Results 1 to 9 of 9

Thread: VBA Code to return a summary sheet of due actions

  1. #1
    Registered User
    Join Date
    06-10-2011
    Location
    belfast
    MS-Off Ver
    Excel 2003
    Posts
    4

    VBA Code to return a summary sheet of due actions

    I'd really appreciate some help on this one as I'm totally confused. I am using Microsot Excel 2003. The idea is fairly simple I have a large workbook, one spreadsheet of which (called review dates) is of client names with corresponding review dates (2 weekly, 3/6/12/18 monthly etc, etc). The columns are conditionally formatted to highlight any dates that fall within a week of the present date but its very time consuming and errror prone to scroll through hundreds of rows of client names plus across a number of columns looking for any due reviews. The idea is then to have a single summary worksheet report, to return all due actions detailing clients name, the date that a review is due and the type of review due, (eg 3 month). As stated any help at all would be good, I'm very new to VBA. Many thanks

    A
    Last edited by ambquinn; 06-13-2011 at 04:14 AM.

  2. #2
    Forum Guru jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2007
    Posts
    2,573

    Re: VBA Code to return a summary sheet of due actions

    Hi A & Welcome to the Board,

    My initial impression is a pivot-table. If this does not suit your needs then how about attaching a small sample workbook of what you have and what you desire.

    http://www.pivot-table.com/
    http://peltiertech.com/Excel/Pivots/pivottables.htm
    HTH
    Regards, Jeff

    If you like the answer(s) provided, why not add some reputation by clicking the * below
    Please use [ Code ] tags when posting [ /Code ]
    Please view/read the Forum rules --- How to mark a thread as solved

  3. #3
    Registered User
    Join Date
    06-10-2011
    Location
    belfast
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: VBA Code to return a summary sheet of due actions

    Thanks for getting back to me. No, don't think a pivot table would suit the purpose. I have attached a small sample of what I'm looking for, (the actual one is a lot bigger with many more sheets). But essentially, its to return a "table" on the "summary actions due" spreadsheet detailing the client name, date action due and the type of review due, which is obviously based on data on the "review dates" sheet which is a dynamic table hundreds of rows long and may be up to 20 columns across.
    Attached Files Attached Files

  4. #4
    Forum Guru jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2007
    Posts
    2,573

    Re: VBA Code to return a summary sheet of due actions

    Ok based on your sample, you only have one name, Callum. Any reason why only one name?

    So in the end, do you want all names which are 7 days on either side of today's date along with the type of review?

    Do you want the results wiped out everytime you rerun this macro? I don't see a formula that will do it, but that could just be my lack of understanding.
    HTH
    Regards, Jeff

    If you like the answer(s) provided, why not add some reputation by clicking the * below
    Please use [ Code ] tags when posting [ /Code ]
    Please view/read the Forum rules --- How to mark a thread as solved

  5. #5
    Registered User
    Join Date
    06-10-2011
    Location
    belfast
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: VBA Code to return a summary sheet of due actions

    No, sorry I didn't make myself clear enough - I only put the one name (Callum) on the "summary actions due" sheet to show the kind of info that I would need returned from the "review dates" sheet ie the name, date and type of review, but it would need to return all those who fall preferably within 7 days either side of todays date or at least the 7 days prior to today. The macro would be ran once a week in an effort to get a comprehensive list of all due reviews that had to be booked in.
    Thanks
    A

  6. #6
    Forum Guru TMShucks's Avatar
    Join Date
    07-15-2010
    Location
    Manchester, England
    MS-Off Ver
    MSO 2003 & 2007
    Posts
    6,228

    Re: VBA Code to return a summary sheet of due actions

    I think this will do it:

    Option Explicit
    
    Sub ReviewDates()
    
    Dim rd As Worksheet: Set rd = Sheets("review dates")
    Dim sadNextRow As Long
    Dim CheckDate As Date
    Dim rdLastRow As Long
    Dim rdLastCol As Long
    Dim cell As Range
    
    With Sheets("summary actions due")
        sadNextRow = .Range("B" & .Rows.Count).End(xlUp).Row + 1
    End With
    
    With Sheets("review dates")
        CheckDate = .Range("B1").Value
        rdLastRow = .Range("A" & .Rows.Count).End(xlUp).Row
        rdLastCol = .Cells(3, .Columns.Count).End(xlToLeft).Column
    
        For Each cell In .Range("b4", .Cells(rdLastRow, rdLastCol))
            If cell.Value >= CheckDate - 7 _
            And cell.Value <= CheckDate + 7 _
            Then
                With Sheets("summary actions due")
                    .Range("C" & sadNextRow).Value = cell.Value
                    .Range("B" & sadNextRow).Value = rd.Cells(cell.Row, 1)
                    .Range("D" & sadNextRow).Value = rd.Cells(3, cell.Column)
                    sadNextRow = sadNextRow + 1
                End With
            End If
        Next 'cell
    End With
    End Sub

    Regards

  7. #7
    Forum Guru jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2007
    Posts
    2,573

    Re: VBA Code to return a summary sheet of due actions

    Thank you TMShucks for the assist.

    @A: Please let us know if this meets your needs
    HTH
    Regards, Jeff

    If you like the answer(s) provided, why not add some reputation by clicking the * below
    Please use [ Code ] tags when posting [ /Code ]
    Please view/read the Forum rules --- How to mark a thread as solved

  8. #8
    Registered User
    Join Date
    06-10-2011
    Location
    belfast
    MS-Off Ver
    Excel 2003
    Posts
    4

    Smile Re: VBA Code to return a summary sheet of due actions

    That is absolutely brilliant! Works a treat many many thanks to both - it was completely doing my head in!

  9. #9
    Forum Guru TMShucks's Avatar
    Join Date
    07-15-2010
    Location
    Manchester, England
    MS-Off Ver
    MSO 2003 & 2007
    Posts
    6,228

    Re: VBA Code to return a summary sheet of due actions

    You're welcome. Thanks for the rep.

    If this answers your question, please mark your thread as solved. See my signature for details or the FAQ.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0