+ Reply to Thread
Results 1 to 3 of 3

copy two columns without blanks in the first column

Hybrid View

Guest copy two columns without... 05-25-2006, 12:55 AM
Guest RE: copy two columns without... 05-25-2006, 05:10 AM
Guest Re: copy two columns without... 05-26-2006, 10:55 AM
  1. #1
    jeffm
    Guest

    copy two columns without blanks in the first column

    Hopefully someone out there can make this happen for me. I have data
    coming from SQL into Excel that includes dates (in column "a", for
    ex.), and then two additional data elements (columns "b" and "c" for
    ex.) of data. I need to sort through column "b", and where a value
    exists, copy that cell and the cell in column "a" to a second worksheet
    into the same columnar format. The trick that is stumping me is I need
    to skip the blanks in column "b". In other words, sheet2 needs to have
    column "a" and 'b" without the blanks. The column range is from
    a6:a110, b6:b110, c6:c110.

    If I can get that part, then I can get add the next column to do the
    same to another sheet. I would sure appreciate the help.

    Jeff


  2. #2
    Tom
    Guest

    RE: copy two columns without blanks in the first column

    Jeff, this code should do what you're looking for:
    Sub Copy()
    Range("B1").Select
    Selection.AutoFilter
    Selection.AutoFilter Field:=2, Criteria1:="<>"
    Range("A1:B25").Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("A1").Select
    ActiveSheet.Paste
    Range("A1").Select
    Sheets("Sheet1").Select
    Application.CutCopyMode = False
    Range("A1").Select
    Selection.AutoFilter
    End Sub

    HTH
    Tom

    "jeffm" wrote:

    > Hopefully someone out there can make this happen for me. I have data
    > coming from SQL into Excel that includes dates (in column "a", for
    > ex.), and then two additional data elements (columns "b" and "c" for
    > ex.) of data. I need to sort through column "b", and where a value
    > exists, copy that cell and the cell in column "a" to a second worksheet
    > into the same columnar format. The trick that is stumping me is I need
    > to skip the blanks in column "b". In other words, sheet2 needs to have
    > column "a" and 'b" without the blanks. The column range is from
    > a6:a110, b6:b110, c6:c110.
    >
    > If I can get that part, then I can get add the next column to do the
    > same to another sheet. I would sure appreciate the help.
    >
    > Jeff
    >
    >


  3. #3
    jeffm
    Guest

    Re: copy two columns without blanks in the first column

    Tom,

    Thanks. It works great! The old autofilter trick.......

    Jeff


+ 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