+ Reply to Thread
Results 1 to 9 of 9

Copy Columns that the headers(dates) fall within a user defined date range...

  1. #1
    Registered User
    Join Date
    02-01-2013
    Location
    Washington
    MS-Off Ver
    Excel 2010
    Posts
    44

    Copy Columns that the headers(dates) fall within a user defined date range...

    Ok.. I am back again for more help.. so far everyone has been great and I thank you all!!


    I have been searching for a while and have not been able to find any code that will do what I need...

    I have found tons of code to copy rows, but not much for columns.

    this is a description of what I have...

    starting with column "D", the first cell (D1) has a date in it (formatted as a date field 5/3/2013 for example)

    this first cell has been dragged to the right until the date reached 12/31/2013..

    so this has become a header row basically...

    on a seperate sheet (named "main") I have two cells set up where the user will input a "start date" and an "end date".

    what I am trying to do is...

    based on the date range the user inputs, it will copy each column (and header) that falls within (including the input dates) to a new sheet (starting at column D), which i will call this sheet "report".

    oh.. and I might add, the columns with the data will have blank spaces.. (data currently runs down to row 135 but not every cell is filled)


    I have just been stumped on getting it to get the columns... rows, no problem, but columns i am having troubles.


    any help would be great..

    If you need any examples uploaded just let me know so I can make some sample files...


    thanks!!

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Copy Columns that the headers(dates) fall within a user defined date range...

    Please attach a Sample Workbook!

    I can visualize what you are trying to say, but I still request you to attach a Sample Workbook.
    Cheers!
    Deep Dave

  3. #3
    Registered User
    Join Date
    02-01-2013
    Location
    Washington
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: Copy Columns that the headers(dates) fall within a user defined date range...

    OK, attached is a sample cut-down version of the workbook.

    I added a tab so you can see what i am trying to get it to look like

    (named "what it should look like")

    I only added 11 rows of data, but the original has about 135 rows.. you will get the idea..

    and thank you...

    and also note.. the version of excel I work on and use is 2010, this file was made on an older version for sample purpose, as I am not at home...

    Sample2.xls

  4. #4
    Forum Guru
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy Columns that the headers(dates) fall within a user defined date range...

    Try the attached.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-01-2013
    Location
    Washington
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: Copy Columns that the headers(dates) fall within a user defined date range...

    AB33, thank you for the response..

    I will look at it later this evening when I return home and with my more current version of Excel.. I opened it on this older version, and of course nothing worked.

    when I looked at it, it appeared that it copied all of the column headers to the report page and just the columns within the range entered populated with data...

    the population part is great, but i do not need any of the other headers in there. This will be a full years worth of dates, one in each column header. For the report, I only am needing the ones that follow within the entered range to be copied, all the rest are of no value for the report tab.

    I appreciate your assistance with this project...

  6. #6
    Forum Guru
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy Columns that the headers(dates) fall within a user defined date range...

    Zoe,
    You would not able to open it in earlier version anyway.
    As to the headers, you can delete them. I added them manually. The code copies the match dates only.

  7. #7
    Registered User
    Join Date
    02-01-2013
    Location
    Washington
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: Copy Columns that the headers(dates) fall within a user defined date range...

    Ok thanks, I will test it out later tonight when I arrive back home and report back..

    Thank you for your support!!

  8. #8
    Registered User
    Join Date
    02-01-2013
    Location
    Washington
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: Copy Columns that the headers(dates) fall within a user defined date range...

    AB33,

    Thank you for the written Code..

    it works out well.

    I just ended up adding another script to hide all of the empty columns, that way when the end user views the report they will onyl see within thier date range..

    again, thank you for all your help!!

  9. #9
    Forum Guru
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy Columns that the headers(dates) fall within a user defined date range...

    Zoe,
    You are welcome!

+ 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