Results 1 to 3 of 3

Thread: Copy the cells to adjacent after auto filter.

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2012
    Posts
    4

    Question Copy the cells to adjacent after auto filter.

    Team,

    I have some values in column A where they include the negative and positive values and where i wrote the below one to filter and copy the same in adjacent column.

    But i require is After filtering if a3, a7, a8 are having negative values they should copy to adjacent cells that is b3, b7, b8.Am unable to get it.
    Please help........
    Sub AutoFilter_in_Excel()
    Range("A1").AutoFilter Field:=1, Criteria1:="<0", Operator:=xlAnd
    Worksheets("sheet1").Range("A2:A7").Copy _
    Destination:=Worksheets("sheet1").Range("c2")
    Range("A1").AutoFilter Field:=1, Criteria1:=">0", Operator:=xlAnd
    Worksheets("sheet1").Range("A2:A7").Copy _
    Destination:=Worksheets("sheet1").Range("b2")
    End Sub

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Copy the cells to adjacent after auto filter.

    Thread moved to the 'Office Development/VBA' forum... note that while it certainly isn't made clear, the "VB Editor" in Office programs is actually VBA rather than VB, so the 'VB6' forum is not really apt

  3. #3
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Copy the cells to adjacent after auto filter.

    If you know which cells you need to check, it can be like this:

    Code:
    If Range("a3").Value < 0 Then Range("b3").Value = Range("a3").Value

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width