+ Reply to Thread
Results 1 to 3 of 3

Routine to clear one column listobject

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,946

    Routine to clear one column listobject

    Hi,

    i want to clear databody range in listobject, resize table to have only header and first row and transpose array into table.

    I am using code:

    Set lstHidden = HiddenDV.ListObjects("Vn_Input_Tiers_Group")
    
        With lstHidden
            .DataBodyRange.ClearContents
             Set R = .Range.Rows(1).Resize(2)
             .Resize R
            .DataBodyRange.Resize(arrayList.Count).Value = Application.Transpose(a)
        End With
    And this is not working on databodyrange, why?

    I have error there: "Object variable or with block variable is not set"

    Please help,

    Best,
    Jacek

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Routine to clear one column listobject

    If you clear the databodyrange then the reference is set to nothing, which make the next reference to it fail.
    You need to add a listrow first

             .Resize R
            .listrows.add
            .DataBodyRange.Resize(arrayList.Count).Value = Application.Transpose(a)
        End With
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,946

    Re: Routine to clear one column listobject

    thaNK YOU Andy Pope,

    so on worksheet i see the listrow but there is no reference to it.
    I solved the issue in other way - i used not databodyrange but range property of table and with resize is working like a charm,

    Best,
    Jacek

+ 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. Rearrange Table Column (i.e. ListObject.ListColumns...)
    By kestefon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-03-2018, 10:09 AM
  2. Replies: 6
    Last Post: 09-12-2017, 07:37 AM
  3. [SOLVED] Copy filtered column of ListObject to another ListObject
    By snapfade in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-15-2016, 04:00 PM
  4. [SOLVED] naming a routine and calling it in another routine - not a loop
    By HeyInKy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-16-2015, 11:54 AM
  5. I need a 2 column sort routine
    By cbb007 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-24-2014, 01:20 PM
  6. ListObject Total Each Column
    By goss in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2013, 01:59 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