bs0d
Well-known Member
- Joined
- Dec 29, 2006
- Messages
- 622
I'm using a query to dynamically populate a defined table in Excel. I'm trying to re-size the table to the last non-blank row, without success. I'm getting stuck on detecting the non-blank row. Here's what I've tried (two different approaches), both find the last row the table is set to, which includes a bunch of "blank" rows --instead of the last non-blank row:
Once I have the LastRow, I think this code should do the trick to implement the resize:
Since it's a defined table, maybe there are special existing functions that make this easier? Thanks for any help
Code:
LastRow-a = Sheets("DataTab").Cells(Rows.Count, 17).End(xlUp).Row
LastRow-b = DataTab.ListObjects("notes").DataBodyRange.Rows.Count
Once I have the LastRow, I think this code should do the trick to implement the resize:
Code:
Worksheets("tab-name").ListObjects("tablename").resize Worksheets("tab-name").ListObjects("tablename").Range.Resize(LastRow)
Since it's a defined table, maybe there are special existing functions that make this easier? Thanks for any help