Thanks Thanks:  0
Likes Likes:  0
Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: CheckBox Array . . . . I think?

  1. #11
    MrExcel MVP Joe Was's Avatar
    Join Date
    Feb 2002
    Location
    Central Florida, USA
    Posts
    7,539
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    "X" [case sensitive] is the trigger for the copy, if column "A" of that row has a "X" it gets copied. Once copied the "X" is converted to a "*" to let you know what got pasted!

    Otherwise, I don't understand your question?
    What does B2 have to do with A1?
    If A2 is not marked with an "X" it does not get copied.
    JSW: Try and try again: "The way of the Coder!"

  2. #12
    New Member
    Join Date
    Nov 2005
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Sorry I meant A2,

    If the source sheet contains data on B2:B5, and "X"s on A2:A5.
    Data on B2:B5 should get copied since they all have an "X" on column A.
    But after running the macro only the data from B5 get copied.

    Now, If I also include data on C2:C5, then everything get copied.

    thanks.

    This is what i am using:

    Sub Priority()
    Application.ScreenUpdating = False
    Worksheets("Sheet2").Select
    For Each r In Worksheets("Sheet2").UsedRange.Rows
    n = r.Row
    If Worksheets("Sheet2").Cells(n, 1) = "X" Then
    Worksheets("Sheet2").Range(Cells(n, 2), Cells(n, 7)).Copy _
    Destination:=Worksheets("Sheet1").Range("B65536").End(xlUp).Offset(1, -1)
    Else
    End If
    Next r

    Worksheets("Sheet2").Columns("A").Replace What:="X", Replacement:="*", _
    SearchOrder:=xlByColumns, MatchCase:=True

    Application.CutCopyMode = True
    Application.ScreenUpdating = True

    End Sub

  3. #13
    MrExcel MVP Joe Was's Avatar
    Join Date
    Feb 2002
    Location
    Central Florida, USA
    Posts
    7,539
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    I tested this and repaired the code based upon your posted revisions. It should now work for you:

    Sub Priority()
    Dim myRange As Range, myBot&

    Application.ScreenUpdating = False
    Worksheets("Sheet2").Select
    myBot = Range("A65536").End(xlUp).Row
    Set myRng = Range(Cells(1, 1), Cells(myBot, 1))

    For Each r In myRng
    n = r.Row
    If Worksheets("Sheet2").Cells(n, 1) = "X" Then
    Worksheets("Sheet2").Range(Cells(n, 2), Cells(n, 7)).Copy _
    Destination:=Worksheets("Sheet1").Range("A65536").End(xlUp).Offset(1, 0)
    Else
    End If
    Next r

    Worksheets("Sheet2").Columns("A").Replace What:="X", Replacement:="*", _
    SearchOrder:=xlByColumns, MatchCase:=True

    Application.CutCopyMode = True
    Application.ScreenUpdating = True

    End Sub
    JSW: Try and try again: "The way of the Coder!"

  4. #14
    New Member
    Join Date
    Nov 2005
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Great! Thanks a lot Joes Was.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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