Hello There,
I have an excel table ("Table1") with 10 columns. I would like to clear the contents from the 4th column till the last column.
I have the following code:
How can this be done using VBA?
Thanks & regards,
Don
I have an excel table ("Table1") with 10 columns. I would like to clear the contents from the 4th column till the last column.
I have the following code:
Code:
Private Sub BClearTable_Click()
Dim tbl1 As ListObject, tbl1RowCount As Integer, tbl1ColCount As Integer
Set tbl1 = ActiveSheet.ListObjects("Table1")
tbl1RowCount = tbl3.DataBodyRange.Rows.Count
tbl1ColCount = tbl3.DataBodyRange.Columns.Count
'Delete all table rows except first row
With tbl1.DataBodyRange
If .Rows.Count > 1 Then
.Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count).Rows.Delete
End If
End With
'-----------------------------------------------------------------
'Column1,2 and 3 have formulas. Would like to clear the contents from the
4th column onwards
'-----------------------------------------------------------------
How can this be done using VBA?
Thanks & regards,
Don
Last edited: