+ Reply to Thread
Results 1 to 5 of 5

generate report macro - complex

  1. #1
    Registered User
    Join Date
    06-03-2013
    Location
    brussels
    MS-Off Ver
    Excel 2007
    Posts
    94

    generate report macro - complex

    Dear,

    I would like to generate a report.

    Situation:
    I have multiple excel sheets per user (see example attachment excel UAT TEST CASES USER). For a certain day I want to extract all lines from the different worktabs.

    Objective macro:
    - pop up ask which file to use as input to generate the report
    - pop up to ask what day to use for the report (what lines to be extracted - available in column J of every tab.
    - as I have multiple input excel files, the macro should be rerunnable and start on the line where the last record is populated (in order the lines are not erased and in order that all lines per input file are grouped togetehr in the one output-macro excel file)

    The macro should take excel output-maco excel file to populate the records (see attachment).
    - the macro should go through all tabs and check all lines with a value equal to the day that was insterted in the pop up.
    - copy those lines to the output macro xls
    - the first column should be populated with the scenario ID (located in field B4 of every sheet or the name of the tab
    - the remaining fields are just to be extracted from the input file(s)

    I hope this makes a bit sense!

    If not, just come back to me for any questions!

    Many manay many thanks for your help!!!

    rickmeister
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    06-03-2013
    Location
    brussels
    MS-Off Ver
    Excel 2007
    Posts
    94

    Re: generate report macro - complex

    I have made a first try.. but not sure if I'm on the good way:

    Sub report_generator()

    Dim ReportSheet As Worksheet
    Dim VariableDateName As String
    Dim WS_COUNT As Integer
    Dim I As Integer
    Dim sheetje As Worksheet
    Dim r As Long, endRow As Long, pasterowIndex As Long

    Set ReportSheet = ActiveSheet


    'file to open
    fileToOpen = Application.GetOpenFilename("Select test cases report (*.xlsm), *xls", MultiSelect:=False)
    VariableDateName = InputBox("Date (dd/mm/yyyy)", "Enter the test execution date to be extracted", "")
    If fileToOpen <> "False" Then
    Application.Workbooks.Open Filename:=fileToOpen
    Else
    Exit Sub
    End If
    Set ImportWB = ActiveWorkbook

    For Each sheetje In ImportWB.Sheets

    For r = 1 To endRow

    If Cells(r, Columns("J").Column).Value = VariableDateName Then

    Rows(r).Select
    Selection.Copy

    Sheets("report").Select
    Rows(pasterowIndex).Select
    ActiveSheet.Paste

    pasterowIndex = pasterowIndex + 1

    End If

    Next r

    Next sheetje

    End Sub

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: generate report macro - complex

    Hi rickmeister

    Please wrap any Code you post in Code Tags.

    This Code is in the attache File. It assumes the Test Files and the Output File are in the same Folder. Let me know of issues.

    Hold on for a moment...forgot the Scenario ID...
    Last edited by jaslake; 11-21-2013 at 02:03 PM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: generate report macro - complex

    Hi rickmeister

    Let's try this...we still have this
    This Code is in the attache File. It assumes the Test Files and the Output File are in the same Folder. Let me know of issues
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-03-2013
    Location
    brussels
    MS-Off Ver
    Excel 2007
    Posts
    94

    Re: generate report macro - complex

    working like a rock!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Generate Report - Macro
    By mokztan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-09-2013, 03:00 AM
  2. [SOLVED] Macro to Generate Complex Number/Code
    By RichTea88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-06-2013, 10:16 AM
  3. Macro to generate report
    By Dr.SUN in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-23-2012, 05:38 AM
  4. Generate Report using Macro
    By Kohinoor in forum Excel General
    Replies: 1
    Last Post: 03-21-2009, 04:39 AM
  5. Can a Macro generate a report?
    By Fowley in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2008, 08:40 PM

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