View Single Post
 
Old 12-22-2016, 09:48 PM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Quote:
I want the rows and columns created to be apart of the table.
Sorry, that's not what I interpreted to be wanted. Simplifies things.
To add a row to the table (and set its height)
Code:
Private Sub CommandButton1_Click()
' add row to table
    Dim oLo As ListObject
Set oLo = ActiveSheet.ListObjects(1)    'first table on sheet
With oLo
    .ListRows.Add AlwaysInsert:=True
    .Range.Rows(.Range.Rows.Count).RowHeight = 30
End With
End Sub
To add a column to the table (and set its width)
Code:
Private Sub CommandButton2_Click()
' add column to table
    Dim oLo As ListObject
Set oLo = ActiveSheet.ListObjects(1)    'first table on sheet
With oLo
    .ListColumns.Add
    .ListColumns(.ListColumns.Count).Range.ColumnWidth = 24
End With
End Sub
Hope that rectifies things.
Good luck with the project.
Reply With Quote