+ Reply to Thread
Results 1 to 7 of 7

Copying filtered data to txt file

Hybrid View

  1. #1
    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..

    Private Sub CommandButton1_Click()
        Dim x, y, z, myval As String, fPath As String, fName As String
        fPath = "C:\Users\apo\Desktop\": fName = "Test"
        myval = """parot"""
        With Range("H" & Range("H" & Rows.Count).End(xlUp).Row).CurrentRegion
            x = .Value: y = .Columns(7).Value
            z = Application.Transpose(Filter(Evaluate("Transpose(if(" & .Columns(7).Address & "=" & myval & ",row(1:" & .Rows.Count & "),char(32)))"), Chr(32), False))
            If UBound(z) > -1 Then
                With CreateObject("Scripting.FileSystemObject").CreateTextFile(fPath & fName & ".txt", True)
                    .writeline Join(Application.Transpose(Application.Index(x, z, [Transpose(row(3:3))])), vbCrLf)
                End With
            End If
        End With
    End Sub
    Attached Files Attached Files

+ 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