+ Reply to Thread
Results 1 to 7 of 7

Copying filtered data to txt file

  1. #1
    Registered User
    Join Date
    02-27-2015
    Location
    Lithuania
    MS-Off Ver
    2010, 2013
    Posts
    26

    Copying filtered data to txt file

    Hello,

    I have this macro that copies some data from a particular range to a text file:

    Please Login or Register  to view this content.
    But I only want it to copy the data from:

    Range(Cells(newDtop, 3), Cells(newDbot, 3))

    where text "Parot" is available in:

    Range(Cells(newDtop, 7), Cells(newDbot, 7))

    A simple filter doesn't work in this case...

    Your input would be greatly appreciated


    This how I thought of doing it:

    Please Login or Register  to view this content.
    Of course this doesn't work...
    Last edited by mellowtang; 08-10-2015 at 09:44 AM.

  2. #2
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Copying filtered data to txt file

    Very difficult without seeing your workbook, but If Range(Cells(newDtop, 7), Cells(newDbot, 7)).Value = "Parot"
    is looking in G between a cell 2 below the last cell in column H and the bottom of Column G. Is that what you want?

  3. #3
    Registered User
    Join Date
    02-27-2015
    Location
    Lithuania
    MS-Off Ver
    2010, 2013
    Posts
    26

    Re: Copying filtered data to txt file

    Hey,

    Thanks for your reply

    I'm new to these forums and so just getting used to explaining things. Bear with me if you may...

    To answer your question:

    If you look at my workbook you will see the main piece of data then a blank row and then again some data starting at row 25. Let's say we will call this bunch starting at row 25 the New Data. I use newDbot and newDtop to define the row boundaries for the New Data added to the dataset. In which case I don't think it matters whether I use G or H as long they are not blank.

    Each day New Data is added to the main report in order to compare it with historical data and remove duplicates according to some columns. In the attached file duplicated data have been already removed, the only thing left to do is to produce some reports with the New Data.

    If you run my macro in the workbook (make sure to adjust the file destination properly) you will see that every single cellvalue in column C for the New Data is transferred to the text file.

    What I want to do is to copy only those cellvalue from column C for which the respective cellvalue in column G is "Parot".

    So at the end I would get a text file with these two entries:
    "typically as a means"
    "and speed due to unopposed drag,"

    Please don't hesitate to ask if you have any further questions
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Copying filtered data to txt file

    Hi -

    Add condition on the Write line
    Please Login or Register  to view this content.
    event

  5. #5
    Registered User
    Join Date
    02-27-2015
    Location
    Lithuania
    MS-Off Ver
    2010, 2013
    Posts
    26

    Re: Copying filtered data to txt file

    Hey,

    You're a star! It works.

    Thanks

  6. #6
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Copying filtered data to txt file

    Hi..

    Although solved for you.. here's an alternative for you or others..

    Note: Change fPath to suit..

    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-27-2015
    Location
    Lithuania
    MS-Off Ver
    2010, 2013
    Posts
    26

    Re: Copying filtered data to txt file

    Thanks I will try that too.

    It would be really cool if you could explain the difference between the logic of these solutions. However, even if you don't feel like doing so, this forum is bliss

+ 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. Macro that helps copying filtered data in file A and paste to file B ?
    By achimeda in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2013, 02:14 AM
  2. Copying filtered data
    By Lvenom in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-29-2010, 03:22 PM
  3. Excel 2007 : Copying and Pasting with Filtered Data
    By lambed3 in forum Excel General
    Replies: 1
    Last Post: 10-23-2008, 05:19 PM
  4. [SOLVED] Copying Filtered Data to Another Column
    By cinco5 in forum Excel General
    Replies: 1
    Last Post: 10-22-2008, 10:16 PM
  5. Copying Filtered Data
    By coopster in forum Excel General
    Replies: 6
    Last Post: 01-23-2008, 05:30 AM
  6. Copying Filtered Data
    By kmrkmj in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 11-23-2006, 08:26 AM
  7. Copying Filtered Data
    By Shirley Munro in forum Excel General
    Replies: 1
    Last Post: 06-22-2005, 09:05 PM
  8. [SOLVED] Copying filtered data
    By cghall55 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-11-2005, 01:06 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