+ Reply to Thread
Results 1 to 20 of 20

Worksheet Table in User Form

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Worksheet Table in User Form

    I am a heavy use of arrays. But reading the contents in the Locals window is not practical for anything but micro arrays. And dumping it to a WS range is a nuisance - especially if I'm in the middle of testing a Modal form.

    It's not difficult to display an array on a UserForm but I want to be able to:
    1. Sort any column in the ListBox/ComboBox
    2. Apply (and remove) basic filtering of columns

    In other words - I'm visualizing the equivalent of a Worksheet Table running inside a form.

    Has anyone written anything like this?
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  2. #2
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Worksheet Table in User Form

    No one?

    I guess it would be possible to add a 2nd form which would act as the column filter options.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Worksheet Table in User Form

    Hi mc84excel.

    It is a little tough to understand the question without an example or some attachment. You are asking if you can do the work of a table in a VBA array. The answer is YES. It would simply take a lot of code and work slower than using a table in the first place.

    Pivot Tables do a lot of array stuff, like sorting and filtering. Why do you want to put it on a Userform instead of leaving it in a worksheet?

    Look at
    http://www.cpearson.com/excel/VBAArrays.htm
    to see lots of array VBA functions that may get to what you are asking.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Worksheet Table in User Form

    Hi Marvin,

    I don't have an example yet as I'm checking to see if any one has created something like this before I jump in and reinvent the wheel

    Yes, I want to display an arrays results in a userform. The difficult part is that I want it to have similar controls to what a Table has in Excel (Sorting and Filtering options).

    I want this because I'm a heavy user of arrays. I think I'd find it useful when I'm writing code to call a userform that would display the arrays contents so I can check what values the array is currently holding. (It's to assist code writing, I don't need to return any results from the userform). Up to now I've been dumping the array to a new WB and I just find it fiddly. (Particularly if you have screenupdating = False or you are writing a Modal form)

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Worksheet Table in User Form

    Spreadsheet Control?
    If posting code please use code tags, see here.

  6. #6
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Worksheet Table in User Form

    Quote Originally Posted by Norie View Post
    Spreadsheet Control?
    I mean the Filter thingies that appear at the top of each column in a worksheet Table.

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,317

    Re: Worksheet Table in User Form

    Norie is referring to the spreadsheet control from the office web components library (deprecated from XL2007 on but still downloadable) - you can embed it on a userform.
    Everyone who confuses correlation and causation ends up dead.

  8. #8
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Worksheet Table in User Form

    A listview with some filtering comboboxes? Doesn't seem like a huge amount of work - though Norie's suggestion will be much easier, given your appreciation of doing things the hard way, I suspect that will mean that you want to roll your own

  9. #9
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Worksheet Table in User Form

    Quote Originally Posted by Kyle123 View Post
    A listview with some filtering comboboxes? Doesn't seem like a huge amount of work - though Norie's suggestion will be much easier, given your appreciation of doing things the hard way, I suspect that will mean that you want to roll your own
    Ha ha I do things the hard way? I know others here who would agree with you but I don't believe that I do think that way. My philosophy is - If something is already out there and it does everything you want it to then why reinvent the wheel? Wastes time and effort. However I AM prepared to start something 'hard' if it doesn't exist and I want it (e.g. my infamous macro un-recorder)

    P.S. A listview with filtering comboboxes sounds huge to me. I think I will look into Nories suggestion.

  10. #10
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Worksheet Table in User Form

    Quote Originally Posted by romperstomper View Post
    Norie is referring to the spreadsheet control from the office web components library (deprecated from XL2007 on but still downloadable) - you can embed it on a userform.
    Ah. Thank you for explaining that Rory. I didn't know what Norie was referring to. (I have never heard of 'spreadsheet control' before).


    One problem - how do I add 'Spreadsheet Control' to a form? I've looked under 'Additional Controls' and I can't see an Office Web Components Library. I've tried googling how to add SpreadSheet Control and couldn't find anything useful. Could some kind forum user please explain how to do this?

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Worksheet Table in User Form

    What exactly did you look for under Additional Controls?

    I've got the spreadsheet control listed as Microsoft Office Spreadsheet 11.0.

  12. #12
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Worksheet Table in User Form

    I looked for 'Office Web Components Library'

    I'm looking under 'Additional Controls' and there is no 'Microsoft Office Spreadsheet 11.0'. It goes straight from 'Microsoft ListView Control, version 6.0' to 'Microsoft Outlook Body Control'.

    nvm I found it. For anyone reading this who needs it - download this installer from MS: http://www.microsoft.com/en-us/downl....aspx?id=22276
    Last edited by mc84excel; 06-23-2014 at 07:56 PM.

  13. #13
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Worksheet Table in User Form

    This 'Spreadsheet Control' is all new to me. I have it embedded on a UserForm but I'm not certain as to how to proceed next. e.g. How do I programatically populate this control?

    Here's what I am trying to achieve:

    Say I am testing a procedure that involves a 1D or 2D variant array. While testing, I want to browse/search the array data at certain points of the procedure. I would import the finished 'Array Viewer Form' into the workbook and pass the array to this form at these points. Upon closing the form, the procedure would continue. When I am satisfied with the procedure, I remove the form and the associated code.

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Worksheet Table in User Form

    Here's some a very, very simple example of how to populate a spreadsheet control and turn on filtering.
    Please Login or Register  to view this content.

  15. #15
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Worksheet Table in User Form

    Thanks Norie. That helps me grasp it. +1
    Last edited by mc84excel; 06-24-2014 at 08:10 PM.

  16. #16
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Worksheet Table in User Form

    The control seems to be far more limited than a normal worksheet.

    I don't suppose it would be possible to hide the excess columns?(If not, I guess I could just resize the control at runtime and disable the horizontal scroll bar?)

  17. #17
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Worksheet Table in User Form

    Why bother if this is just for debugging?

  18. #18
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,317

    Re: Worksheet Table in User Form

    It's simple enough to hide the columns, it's just like a normal sheet but with more columns:
    Please Login or Register  to view this content.

  19. #19
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Worksheet Table in User Form

    Quote Originally Posted by Kyle123 View Post
    Why bother if this is just for debugging?
    Well when you put it like that, it doesn't really matter I guess. (I'd just like it to look less messy when I use it )

  20. #20
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Worksheet Table in User Form

    Thanks Rory +1

+ 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. Replies: 1
    Last Post: 08-28-2013, 05:04 PM
  2. [SOLVED] Excel vba user form- open directly to user form not worksheet
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 04-24-2013, 05:07 PM
  3. Transfer User form data to a worksheet w.r.t. combobox item on the form
    By nm766 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2011, 12:43 PM
  4. Filling form fields via worksheet dropdowns, user update via form, change form color
    By Demosthenes&Locke in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2010, 08:58 AM
  5. From a User Form to a worksheet
    By Lukan in forum Excel General
    Replies: 1
    Last Post: 01-16-2005, 05:18 PM

Tags for this Thread

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