+ Reply to Thread
Results 1 to 3 of 3

copy specific ranges based on certain values

Hybrid View

  1. #1
    Registered User
    Join Date
    11-14-2007
    Posts
    29

    copy specific ranges based on certain values

    Hi all, and Happy New Year:

    I'm here again to seek help. Here's my scenario:

    My sheet 1 has the values in column A to G; column A only contains 0 or 1.
    I'm looking for a vba code to copy TO a new worksheet the values in columns B to G (they contain results of formulas within the worksheet) IF the value of A is 1. Column A looks like this:
    A B C D E F G
    0
    0
    1
    1
    1
    0
    0

    I'm hoping for the usual help. Many thanks.

    WK

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try something like

    Dim Rng As Range
    Dim DestRange As Range
    Set DestRange = Sheets(2).Range("A" & Sheets(2).Cells(Rows.Count, "A").End(xlUp).Row + 1)
    Set Rng = Range("A1")
        Rng.AutoFilter Field:=1, Criteria1:="1"
        Rng.Offset(1, 0).Resize(Cells(Rows.Count, "A").End(xlUp).Row, _
        Cells(3, 7).End(xlUp).Column).Copy _
        Destination:=DestRange
    ActiveSheet.AutoFilterMode = False
    See link for ideas on tidying it up

    http://www.rondebruin.nl/copy1.htm

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    11-14-2007
    Posts
    29

    Thanks

    Many thanks. Always reliable. A few tweaks, and it should do it.

+ 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