Consulting

Results 1 to 2 of 2

Thread: Sleeper: Invalid references table and copy the valids to another table

  1. #1
    VBAX Regular
    Joined
    Aug 2009
    Posts
    69
    Location

    Sleeper: Invalid references table and copy the valids to another table

    Hello everyone


    I have a table that has a listing that will have invalid references (deliberate).

    It is possible to get this table and copy to another, but only the valid.

    The size of the table is random....


    Source table:

    5 |#REF!
    2 |1
    2 |#REF!
    5 |#REF!
    5 |30
    5 |40
    7 |#REF!
    … |…



    Destination table:

    2 |1
    5 |30
    5 | 40
    … …


    Imagining that the source table starts in A1 and the target table in N53

    I thank you


    Regards,
    Miguel
    Last edited by jmaocubo; 04-06-2010 at 09:35 AM.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Air-coded

    Public Sub ProcessData()
    Const TEST_COLUMN As String = "A"    '<=== change to suit
    Dim i As Long
    Dim LastRow As Long
    Dim NextRow As Long
    With ActiveSheet
        LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
        For i = 1 To LastRow
            If IsError(.Cells(i, TEST_COLUMN).Offset(0, 1).Value2) Then
                .NextRow = NextRow + 1
                .Rows(i).Copy Worksheets("Sheet2").Cells(NextRow, "A")
            End If
        Next i
    End With
    End Sub
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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