I wrote some code that with the click of a button called "FILTER" it converts several ranges into independent ListObjects with this code:
Ows.ListObjects.Add(xlSrcRange, MyRange.Offset(0, 0), , xlYes).Name = "a"
Ows.ListObjects.Add(xlSrcRange, MyRange.Offset(0, 0), , xlYes).Name = "b"
and then automatically filters out zeros and blanks based on data from one column called "Qty" using this code:
Ows.ListObjects("a").TableStyle = ""
Ows.ListObjects("a").Range.AutoFilter field:=2, Criteria1:=">0", Operator:=xlAnd
Then with the click of another button, I reset the ListObject back to a range with this code:
Ows.ListObjects("a").Unlist
Ows.ListObjects("b").Unlist
The above works fabulously. Here's the problem.
I have quite a few columns in the table and I wish to print everything out on one sheet. That's easy enough. I just format several column widths to equal 8. The problem comes in, when the range turns into a ListObject, these columns widen to fit the text in the column headers. I set the cell format for "wrap text", but that doesn't cure it. How do I keep the column width from widening after converting a range into a ListObject?
Bookmarks