Results 1 to 2 of 2

ListObject

Threaded View

  1. #1
    Registered User
    Join Date
    11-14-2008
    Location
    Tampa
    MS-Off Ver
    Professional Plus 2007
    Posts
    30

    ListObject

    I wrote code that on the click of a button "FILTER", the code will automatically convert several ranges into individual ListObjects and then filter out blanks and zeros from one of the columns.

    Then on the click of another button "UNFILTER", it will automatacally unfliter the table and convert the ListObject back into a range.

    Here's the code:

    To Filter:

    Ows.ListObjects.Add(xlSrcRange, MyRange.Offset(0, 0), , xlYes).Name = "a"
    Ows.ListObjects("a").TableStyle = ""
    Ows.ListObjects("a" & z).Range.AutoFilter field:=6, Criteria1:=">0", Operator:=xlAnd
    
    Ows.ListObjects.Add(xlSrcRange, MyRange.Offset(124, 0), , xlYes).Name = "b"
    Ows.ListObjects("b").TableStyle = ""
    Ows.ListObjects("b").Range.AutoFilter field:=6, Criteria1:=">0", Operator:=xlAnd
    To Unfilter:

    Ows.ListObjects("a").Unlist
    Ows.ListObjects("b").Unlist
    where Ows is an ActiveSheet variable

    The code works just fine. Here is the problem.

    When I click FILTER and the range converts to a ListObject, several of the narrow columns automatically widen to fit the the width of the header text. I had set the column width to 8, and set the cell format for "wrap text", but upon conversion from range to ListObject, the text does not "wrap" and the row does not widen to accomodate wrapped text. Instead the column widens, which is what I don't want since it becomes too wide to print.

    Anyone have any suggestions on how to fix this?
    Last edited by costadina; 04-25-2009 at 08:39 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1