+ Reply to Thread
Results 1 to 1 of 1

Resize table based on cell values

  1. #1
    Registered User
    Join Date
    03-21-2019
    Location
    Barnsley, England
    MS-Off Ver
    2016
    Posts
    9

    Resize table based on cell values

    Hope someone can help?

    Maybe a small macro is all I need. I have a table 9 columns x 14 rows, the cells are mapped to a xml schema, the problem I have is when data is entered into some of the cells programmatically, I need to sort the table so all nil values are placed under items with values, then resize the table to exclude the nil values (leaving the data intact)

    After posting the xml I then need to resize the table again to include all 14 rows.


    many thanks

    Rob

    Update:

    I have the following macro sorting the table and resizing manually, however I need the resizing to stop when a value more than zero is reached in say a qty column.

    Sub Sort_Table()
    '
    ' Sort_Table Macro
    '

    '
    Range("Table2").Select

    ActiveWorkbook.Worksheets("XML_DATA").ListObjects("Table2").Sort.SortFields. _
    Clear
    ActiveWorkbook.Worksheets("XML_DATA").ListObjects("Table2").Sort.SortFields. _
    Add2 Key:=Range("Table2[ns1:Qty]"), SortOn:=xlSortOnValues, Order:= _
    xlDescending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("XML_DATA").ListObjects("Table2").Sort
    .Header = xlYes
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
    End With
    Range("K27").Select
    ActiveSheet.ListObjects("Table2").Resize Range("$C$12:$K$15")
    Range("K27").Select
    End Sub
    Last edited by robhall1966; 03-24-2019 at 07:52 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel VBA to insert & resize picture based on cell url
    By shabeersa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2016, 03:54 AM
  2. Resize table based on Cell value
    By jdurand2 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-15-2014, 11:01 AM
  3. Please Help: Resize multiple shapes in the same sheet based on cell value
    By BartekKonopka in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-19-2013, 02:27 PM
  4. Resize a shape based on cell value.
    By Environment in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-19-2013, 12:35 PM
  5. [SOLVED] VBA to resize a table based on a cell value
    By Vasool in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-24-2013, 06:10 PM
  6. [SOLVED] Return table of values based off of one cell value
    By knguyen777 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-22-2013, 12:55 PM
  7. Resize range (table) in VBA based on last row value in another worksheet
    By Erin1986 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2013, 01:36 AM

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