fairly straightforward question:
I've got an excel ListObject("list")
. It's part of a longer procedure - in particular it is launched from an UserForm
that triggers this procedure upon every Change
What I'm trying to do, is: Simply clear the table and leave only the .HeaderRowRange
unchanged.
Dim temp as Range
Dim ws2 As Worksheet: Set ws2 = Sheets("Pomocne")
Dim tbl As ListObject: Set tbl = ws2.ListObjects("list")
If Not tbl.DataBodyRange Is Nothing Then
tbl.DataBodyRange.ClearContents
Set temp = tbl.HeaderRowRange
Set temp = temp.Resize(2)
tbl.Resize temp
End If
Now this works all nice and fine. However, weird part is, if I change the ComboBox
too many times, then suddenly the Resize
method fails for seemingly no reason.
Additionally, if I try to check anything, I get a message that Excel has run out of memory.
Is there perhaps any way, I could re-size the table in a more memory friendly way that would not result in an error after multiple changes? Or perhaps am I resizing the table range incorrectly?