I have excel worksheets with a usedrange that consists of two dynamic tables/blocks.
On the right-hand side, there is table 1 with raw data (beginning in cell A1). Then, there is an empty column E:E (for example), followed by some formulas in a table beginning at F1 (for example).
I need to only clear the content of table 1. Table 2 needs to remain where it is and I was not yet able to figure out how.
When I do
Set StartCell1 = Range("A1") ' select first cell of table 1
StartCell1.CurrentRegion.Select ' attempt to select whole table 1
Selection.ClearContents ' attempt to clear table 1
Both table 1 and table 2 are deleted.
How to select only the subset of a usedrange that is continuous (i.e. no empty columns/rows) in excel-VBA?
Note that the dimensions of both tables as well as the number of blank columns in between varies between sheets.