Hello i have a table called Tbl_JE on a sheet called JEP. I am trying to clear it and then resize it that way something can be copy and pasted into it again
I got code to clear it but when trying to do a resize i am getting errors. Trying to find the best way to do so
I got code to clear it but when trying to do a resize i am getting errors. Trying to find the best way to do so
VBA Code:
Sub cleardata()
'Definf Sheet and table name
With Sheets("JEP").ListObjects("Tbl_JEe")
'Check If any data exists in the table
If Not .DataBodyRange Is Nothing Then
'Clear Content from the table
.DataBodyRange.ClearContents
End If
End With
Dim tbl As ListObject
Set tbl = ActiveSheet.ListObjects("Tbl_JE")
tbl.Resize tbl.Range.CurrentRegion