+ Reply to Thread
Results 1 to 3 of 3

Extracting cells from certain criteria

  1. #1
    Registered User
    Join Date
    11-10-2004
    Posts
    23

    Unhappy Extracting cells from certain criteria

    A happy new year to you all!

    Once again I need some assistance.

    I have a spreadsheet with a list of names and whether they are active or not.

    IE:

    A10=John Smith B10=Active C10=5 D10=6
    A11=John Jones B11=Active C11=4 D11=1
    A12=Bert Smith B12=Inactive C12=0 D12=0
    A13=Hugh Brown B13=Inactive C13=0 D13=0
    A14=James Green B14=Active C14=19 D14=4

    I need a macro that will search the ranges from B10 to B50 and copy only the surrounding cells A:D to another part of the spreadsheet (for example, M:P) where the B cell is "Active". Also, the new cells must not have missing rows.

    In the example above, the ranges A10:D10, A11:D11, and A14:D14 would be copied to cells M10:P10, M11:P11, and M12:P12 (not M14:P14) respectively.

    I'm sure this could be done fairly simply, but it's doing my head in.

    Any help would be greatly appreciated.

    Thanks,

  2. #2
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451

    Extracting cells from certain criteria

    Try this macro

    Sub macro()
    Dim i, k, k1 As Integer
    k = 10
    k1 = 10
    For k = 10 To 50
    If UCase(Range("b" & k).Value) = "ACTIVE" Then
    Range("a" & k & ":" & "d" & k).Select
    Selection.Copy
    Range("f" & k1).Select
    ActiveSheet.Paste
    k1 = k1 + 1
    End If
    Next
    End Sub

  3. #3
    Registered User
    Join Date
    11-10-2004
    Posts
    23
    Thanks, I'll give it a try - sorry for the delay in replying, I AM grateful!!!

+ 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