Advertisement
Guest User

bira_code

a guest
Dec 15th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub AdicionaLinha(ByVal strTableName As String, ByRef arrData As Variant)
  2.     Dim tbl As ListObject
  3.     Dim NewRow As ListRow
  4.  
  5.     ' Based on OP
  6.    ' Set Tbl = Worksheets(4).ListObjects(strTableName)
  7.    ' Or better, get list on any sheet in workbook
  8.    Set tbl = Range(strTableName).ListObject
  9.     Set NewRow = tbl.ListRows.Add(AlwaysInsert:=True)
  10.  
  11.     ' Handle Arrays and Ranges
  12.    If TypeName(arrData) = "Range" Then
  13.         NewRow.Range = arrData.Value
  14.     Else
  15.         NewRow.Range = arrData
  16.     End If
  17. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement