+ Reply to Thread
Results 1 to 6 of 6

Identifying and appending a date to data

  1. #1
    Registered User
    Join Date
    06-11-2014
    Posts
    20

    Exclamation Identifying and appending a date to data

    Hello,

    I am dealing with data that is provided to me daily. It is organized into tables, with a merged header row (spanning 17 columns). The heading has the date for whatever day the data was provided. The format of the heading is always as follows: "Claims Summary (BW) for DD-Month-YYYY". For example - data provided on January 6th will read as "Claims Summary (BW) for 06-Jan-2015" (of course, no quotations. I provided them).

    The tables contain the data for that day (99% of the time the table is 17 rows of data). I have created Macros that takes all the daily data tables by month, and copy/pastes the tables on top of one another. I then have a macros that identifies the rows I need and copies/pastes them to an aggregated data sheet, from which I have pivots pulling from.

    I would like to automate this process completely. Basically, when the data is identified, copied, and pasted from the "stacked" tables, the dates for the data need to be provided as well. For example: If the data was from January 6th 2015. The header for that daily data table would read as "Claims Summary (BW) for 06-Jan-2015". So for all data rows copied from that table, each of those rows would need to be marked with that date (1/6, or January 6th, etc.). For the next table for January 7th, the data for that table would need to be marked with that date. So on and so forth. All that is needed is the dates to be placed in the column next to the last column of the table (column 18).

    This would need to be done in a loop so that it would go through all the stacked tables for whatever month i designated, and copy paste the data into the consolidated sheet with appended dates.

    I have provided an example of each of the three stages I am talking about:

    1. The daily data tables as I receive them
    2. The stacked tables (done by a macro). Data is copied from this sheet.
    3. The consolidated data sheet. The data is pasted into this sheet

    I have everything from this process automated except for this function! Any help would be appreciated!

    Thank you,

    - J
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Identifying and appending a date to data

    This will put the date in a string variable. Then you could probably add it too your other code. Hope that helps.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-11-2014
    Posts
    20

    Re: Identifying and appending a date to data

    Where would I add it in here?

    For k = 2 To LastRow
    Select Case Cells(k, 2).Value
    Case Is = "Inst (5010)", "Prof (5010)"
    Range(Cells(k, 1), Cells(k, 17)).Copy Worksheets("Hello").Range("A" & Rows.Count).End(3)(2)
    End Select
    Next k

    Also, could you please explain .End(3)(2). Just so I understand how it works exactly.

    Thanks!

    - J

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Identifying and appending a date to data

    Please use code tags when posting. Maybe:

    Please Login or Register  to view this content.
    .End(3)(2) - (3) is a shorter version of (xlUp) (2) is another way to do a row offset (ie the last row with data would be (1), row after (2)

  5. #5
    Registered User
    Join Date
    06-11-2014
    Posts
    20

    Re: Identifying and appending a date to data

    Ok. Thank you for the explanation (regarding the End). Makes sense.

    As for the macros, after I added LastRow = Range("A" & Rows.Count).End(xlUp).Row, it is performing the copy/paste with the criteria, but no dates are appended.

    Are you sure Right([A1], 11) will work in this situation?

    Thank you.

    - J

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Identifying and appending a date to data

    Can you attach a sample to test on. The example provided doesn't seem to reflect what you are after. Right([A1], 11) worked for me when I tried to draw the date from your example. Test on your Sheet "Daily Table".

    Please Login or Register  to view this content.

+ 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. [SOLVED] Excel 2010 Identifying data changed in cells and Identifying the changed rows
    By SandyLake in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-13-2013, 01:12 AM
  2. [SOLVED] VB Script for saving excel file appending weekend's date to the filename
    By alexgempesaw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-26-2013, 03:59 AM
  3. Macro help - appending a date to a file name when saving
    By Cyali in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-10-2012, 06:34 PM
  4. Identifying the first date(s) from a list
    By amy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-01-2006, 04:10 AM
  5. Appending filename with date
    By kapil.dalal in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-30-2005, 07:05 AM

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.6.0 RC 1