1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copy 3 column of a table on sheet 1 to another table in sheet 2

Discussion in 'VBA Macros' started by Belleke, Feb 10, 2019.

  1. Belleke

    Belleke Active Member

    I have this code that works except that the data has to go in the table on sheet 2, this code puts the data under the table.
    Code (vb):
    Private Sub Cmd_09_Click()
    Set DT = Sheets("Data")
    Set NB = Sheets("Nog te betalen")
    On Error Resume Next
    With DT
        ar = .Cells(1).CurrentRegion
        ReDim ar1(UBound(ar), 3)
        For s = 2 To UBound(ar)
        If ar(s, 12) <> "" Then
              ar1(t, 0) = ar(s, 1)
              ar1(t, 1) = ar(s, 3)
              ar1(t, 2) = ar(s, 12)
              t = t + 1
        End If
        Next s
    NB.Cells(Rows.Count, "A").End(xlUp).Offset(1).Resize(UBound(ar1) + 1, UBound(ar1, 2) + 1) = ar1
    End With
    End Sub

Share This Page