+ Reply to Thread
Results 1 to 10 of 10

UserForm and Tables

  1. #1
    Registered User
    Join Date
    10-09-2017
    Location
    Stavanger, Norway
    MS-Off Ver
    O365
    Posts
    78

    UserForm and Tables

    I've generated a UserForm and coded it to update data in a sheets. I would like to create a TABLE from the data sheet. Will I need to rewrite the code or will the existing code work?
    I am working off Excel version 2109 from Office 365

    Cheers
    Simon

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: UserForm and Tables

    Please update your profile to indicate you are using O365. 2109 is a release number and not a version.

    Please read the yellow banner at the top of this page. Also, we cannot analyze code when we cannot see it.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    10-09-2017
    Location
    Stavanger, Norway
    MS-Off Ver
    O365
    Posts
    78

    Re: UserForm and Tables

    @Alan
    Thanks for the hints
    Enclosed is a text file with the relevant code
    I have Command buttons for DELETE,EXIT,RESET, SEARCH, UPDATE, REFRESH & SAVE

    I intend to name the TABLE "ANALYSISDB"
    Attached Files Attached Files

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,303

    Re: UserForm and Tables

    upload the actual workbook - nobody will be willing to try to recreate your form.
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  5. #5
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,303

    Re: UserForm and Tables

    I was bored so created the attached to fit in with how I pictured your form.
    The referencing follows the 'table' protocol rather than 'range' referencing.
    To enter data first 'CLEAR' the form, this will enable the 'ADD' button, fill in your data and press 'ADD' to save to sheet.
    Other actions should be intuitive.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    10-09-2017
    Location
    Stavanger, Norway
    MS-Off Ver
    O365
    Posts
    78

    Re: UserForm and Tables

    @Torachan
    I'm very happy that you were bored... what you did seems to work very well... I've been trying and trying without success, there does seem to be many ways to skin a cat... I will definitely go with your version... Many Many thanks, there has been much gnashing of teeth here!!

    Thanks
    Simon

  7. #7
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,303

    Re: UserForm and Tables

    thanks for the feed-back, glad to have helped, any further queries just post back on this site.

  8. #8
    Registered User
    Join Date
    10-09-2017
    Location
    Stavanger, Norway
    MS-Off Ver
    O365
    Posts
    78

    Re: UserForm and Tables

    @torachan
    I've been trying to orgainise the ListBox a bit better, change the column widths and labels to appear over the Listbox items.. Is it not possible to add the TABLE headers, rather than use a LABEL as you have done. I have added .ColumnHeads = True to the UserForm_Initialize routine (the Headers appear but are blank), but can't seem to define the Column Headers contents. Any suggestions.

  9. #9
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,303

    Re: UserForm and Tables

    The .ColumnHeads only works with the .Rowsource method of populating the listbox, this method is the least stable and is not recommended (it is a throw-back to early VB).
    Its major problem is it reads the sheet at every single change and can get out of sync and crash or corrupt the data, there are many documented reasons on the web.
    this link is a good insight for combo/listbox populating, my prefered method for many years has been to populate the entire list from an array of the total data table, by that method the data is then in memory greatly reducing reading/writing to the sheet.
    I have in the past where there are a large number of columns I have synced the header label to the horizontal scroll of the listbox, I will go through my 'archives' and see if I can find the particular app and post it back here later today.

  10. #10
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,303

    Re: UserForm and Tables

    attached file demo's how to scroll label above listbox - on the multipage tabs 'print' and 're-order' - the re-order tab is for adjusting the sequence of items in the listbox.
    Attached Files Attached Files

+ 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. [SOLVED] Create userform with dependent combobox based on different tables
    By awoolfe in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2021, 11:20 AM
  2. Update data between two tables using userform vba
    By jdasp49 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-25-2021, 10:26 AM
  3. Formatting Of Word Tables From Userform
    By bssm in forum Word Programming / VBA / Macros
    Replies: 8
    Last Post: 03-08-2015, 12:56 PM
  4. Remove tables using userform in VBA
    By GeorgeMustang in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-19-2014, 07:25 AM
  5. Lookup tables converted to userform with VBA
    By molesy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-12-2014, 08:38 AM
  6. Updating multiple tables from the same userform
    By rammy123 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-30-2013, 06:13 AM
  7. Replies: 1
    Last Post: 08-14-2010, 02:53 AM

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