Announcement

Collapse
No announcement yet.

Macro to copy rows to another worksheet if a cell matches a specific format

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Works really well, much faster, thank you!!

    Comment


    • #17
      You're welcome. You should find that there is very little increae in code runtime with your actual data of 10000+ rows, and the runtime will be a few of seconds as opposed to 10 mins with the previous code.
      We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

      Comment


      • #18


        HI.. Here's another one to try..

        It would be interesting to see which one is faster.. probably KJ's as although there is an extra loop.. it's all array based.

        Code:
        Private Sub CommandButton1_Click()
            Dim x, y, i As Long, strRows As String
            With Sheets("Combined").[A1].CurrentRegion
                x = .Value
                For i = LBound(x) To UBound(x)
                    If Not x(i, 10) Like "###[-]###[-]#" Or x(i, 10) = "" _
                        Or x(i, 10) Like "[9]##[-]###[-]#" Then strRows = strRows & " " & i
                Next i
                       With Sheets("CheckAccts")
                            y = Application.Index(x, Split(Trim(strRows)), Evaluate("row(1:" & UBound(x, 2) & ")"))
                            .[A1].Resize(UBound(y, 2), UBound(y)) = Application.Transpose(y)
                            .Columns.AutoFit
                        End With
            End With
        End Sub
        Valuable Resources:

        snb's Website:
        http://www.snb-vba.eu/index_en.html

        Smallmans Website:
        http://www.thesmallman.com/

        Comment

        Working...
        X