+ Reply to Thread
Results 1 to 19 of 19

Filter only date and copy to new with entire columns

  1. #1
    Forum Contributor
    Join Date
    05-01-2020
    Location
    CHENNAI
    MS-Off Ver
    EXCEL 2010
    Posts
    105

    Post Filter only date and copy to new with entire columns

    Hi,

    Seeking some one help to create vba macro. I have large data in Excel CSV File. Header row start from Row 6. From column C6 to be filtered with date (to be excluded text and blank cells) and the the filtered data of entire columns to be pasted in new worksheet. kindly help me.
    Attached Files Attached Files

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Filter only date and copy to new with entire columns

    Hey SARAN89 … Try the below code, I assume there are no numbers in column C other than the dates. Make sure the sheet name is the same as per your workbook

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    05-01-2020
    Location
    CHENNAI
    MS-Off Ver
    EXCEL 2010
    Posts
    105

    Re: Filter only date and copy to new with entire columns

    Hi Nankw83. Thank you so much for your help.

    Code is working as expected but its missed to copy and paste of Header Row (ROW 6 is my header). Please help to include that and also requesting please mention active sheet instead mentioning sheet name as "Sample File" (it will be different type of sheets) Thanks

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Filter only date and copy to new with entire columns

    How about below code

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-01-2020
    Location
    CHENNAI
    MS-Off Ver
    EXCEL 2010
    Posts
    105

    Re: Filter only date and copy to new with entire columns

    Hi Nankw83.

    Thanks this code is working fine as expected. now header also coming. Column 6 dont have any numbers however some numbers i have in another column, on out put file its pasting that number row also (though i have no date in same row under column "C")

  6. #6
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Filter only date and copy to new with entire columns

    Column 6 dont have any numbers
    Column 6 ? It is based on the attached file in post #1 ? If not, post another file to see

  7. #7
    Forum Contributor
    Join Date
    05-01-2020
    Location
    CHENNAI
    MS-Off Ver
    EXCEL 2010
    Posts
    105

    Re: Filter only date and copy to new with entire columns

    Hi Nankw83

    Attached supporting file with numbers on other column also attached out put file for your reference. Refer cell AH23 on out put file.
    Attached Files Attached Files

  8. #8
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Filter only date and copy to new with entire columns

    I was checking the last row in column C but it seems your data is not fixed ... I have changed the code to look for the last columns used in the sheet instead ... Try the below

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    05-01-2020
    Location
    CHENNAI
    MS-Off Ver
    EXCEL 2010
    Posts
    105

    Re: Filter only date and copy to new with entire columns

    Perfect. Now its 100% fine. thanks for your support.

  10. #10
    Forum Contributor
    Join Date
    05-01-2020
    Location
    CHENNAI
    MS-Off Ver
    EXCEL 2010
    Posts
    105

    Re: Filter only date and copy to new with entire columns

    Hi nankw83
    Is it possible to close the first workbook (where we are copying data,) after pasting in to new workbook. I tried the below code but its not closing.
    "Workbooks(1).Close"

  11. #11
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Filter only date and copy to new with entire columns

    I have added lines to close the first workbook

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    05-01-2020
    Location
    CHENNAI
    MS-Off Ver
    EXCEL 2010
    Posts
    105

    Re: Filter only date and copy to new with entire columns

    Sorry its not closing the first workbook.

  13. #13
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Filter only date and copy to new with entire columns

    What is closing ? You placed the macro in the workbook where you copy the data from ?

  14. #14
    Forum Contributor
    Join Date
    05-01-2020
    Location
    CHENNAI
    MS-Off Ver
    EXCEL 2010
    Posts
    105

    Re: Filter only date and copy to new with entire columns

    Hi Nankw83.

    I placed the macro in personal macro excel workbook. Once data copied and pasted in new workbook. the initial workbook want to close it automatically.

  15. #15
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Filter only date and copy to new with entire columns

    Oh ok I see … Then change wb = ThisWorkbook to wb = ActiveWorkbook

  16. #16
    Forum Contributor
    Join Date
    05-01-2020
    Location
    CHENNAI
    MS-Off Ver
    EXCEL 2010
    Posts
    105

    Re: Filter only date and copy to new with entire columns

    Great.....its worked. thanks for your support...............

  17. #17
    Forum Contributor
    Join Date
    05-01-2020
    Location
    CHENNAI
    MS-Off Ver
    EXCEL 2010
    Posts
    105

    Re: Filter only date and copy to new with entire columns

    Hi Nankw83. I slightly modified the code for my exact requirement. Code is working fine.

    Currently the code is copying specific data from one worksheet( Say Workbook A) and pasting in new worksheet (Say Workbook B).i want to modify the code with your help as below.

    Need to select multiple files, the code should copy one by one from source work book, and then to be pasted in new worksheet.
    Example copy and paste first source file to one workbook (We can save this work book as "Main File"). Then the second source file data to be copied and pasted in last row of main file.similarly for all source file i am selecting. Can you please help me to modify the code?

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  18. #18
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Filter only date and copy to new with entire columns

    I suggest that you start a new thread since your new request is irrelative to this thread question which is marked as solved. In your new thread, be more specific as if all the files in question are in the same folder or not & don't include your code in post # 17 since it has nothing to do with your request so members could provide you with the proper solution.

  19. #19
    Forum Contributor
    Join Date
    05-01-2020
    Location
    CHENNAI
    MS-Off Ver
    EXCEL 2010
    Posts
    105

    Re: Filter only date and copy to new with entire columns

    understood. will create new thread.

+ 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. Autofilter VBA Macro to filter out individual columns across entire workbook
    By prnetreba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2017, 06:45 PM
  2. Comparing Columns and Copy entire row
    By ahsanzafar in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-10-2015, 06:13 AM
  3. Filter and copy non continguos columns (criteria by Date another sheet)
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-28-2015, 12:36 PM
  4. Copy Entire Row On Filter Data Including Hidden Columns
    By FallingDown in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2014, 04:17 AM
  5. Filter Date and Delete entire row except headers
    By FLani in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-10-2014, 07:41 PM
  6. [SOLVED] Compare columns and copy entire row
    By twhite79 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-02-2013, 09:21 AM
  7. Replies: 1
    Last Post: 11-16-2012, 05:05 PM

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