+ Reply to Thread
Results 1 to 26 of 26

Using List boxes and text boxes with complex data sets

  1. #1
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Lightbulb Using List boxes and text boxes with complex data sets

    Hey there

    I'm wondering if you can help. I am using a Macro to gather information to write to a spreadsheet. The spreadsheet uses multiple macro entry points and compiles information.

    The macro I am using is below, however the macro errors at the following point
    Please Login or Register  to view this content.
    I'm really not sure why this would be the case, the macor should be taking all the entries from the user form and writing to relevant cell in another sheet. ANy help would be greatly appreciated. the full code is below


    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Using List boxes and text boxes with complex data sets

    What is the length of "ListStr"?

    It might give error when the length is less than 2...

  3. #3
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Using List boxes and text boxes with complex data sets

    Hi there

    The length is multiple lines of data, despite changing this, the macro doesn't run as I would have expected which begs the question if the macro is properly formed

    Any ideas?

    M

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Using List boxes and text boxes with complex data sets

    You are not answering to my question.
    What is the length of "ListStr"?
    It could have no value when no item selected in Listbox.

  5. #5
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Using List boxes and text boxes with complex data sets

    Morning Jindon

    The length in characters could be up to 1058 characters made up of 21 lines. You are correct, no value could exist should nothing be in the list box

    Thanks

  6. #6
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Using List boxes and text boxes with complex data sets

    Hi Jindon

    I've been looking into this more, in terms of length
    Please Login or Register  to view this content.
    , is the code not wrapping this with the Len section?

    Thanks

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Using List boxes and text boxes with complex data sets

    You can check it with adding one line
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Using List boxes and text boxes with complex data sets

    Thanks - I really do not understand

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Using List boxes and text boxes with complex data sets

    Then need to see your workbook.

  10. #10
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Using List boxes and text boxes with complex data sets

    Please see the attached
    Attached Files Attached Files

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Using List boxes and text boxes with complex data sets

    It looks into ListBox2 (one on the right side), so if you select the item(s) from ListBox2, it works.

    Did you write the code for yourself?

  12. #12
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Using List boxes and text boxes with complex data sets

    Hey Jindon

    I wrote the code for the Listbox one and two myself, however I tried to get help with the writing of the text, combo and list boxes to the master sheet.

    The macro works well for everything when selecting the ok button but returning the ListBox as a string is really the issue I'm having, it's much more complicated than I initially thought!

    Any ideas?

  13. #13
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Using List boxes and text boxes with complex data sets

    Hey Jindon

    I wrote the code for the ListBox macro myself and it works.

    I saught aid for the writing of the user form to an existing data set, when selecting ok on the user form, the macro writes well for TextBox and ComboBox but not a ListBox as a string, that's the area I'm really struggling getting to work.

    Any ideas?
    Michael

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Using List boxes and text boxes with complex data sets

    1) I would check if the user select any item(s) from list box2,
    e.g
    Please Login or Register  to view this content.
    And change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Then
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Using List boxes and text boxes with complex data sets

    Thanks Jindon

    The check is really useful as I should have picked this one up to maximise the use of the user form.

    I still seem to have an issue whereby the row is not updating using the following code

    Please Login or Register  to view this content.
    I have not used the vbLf item before, would this need something within the DIM to identify?

    Many thanks
    Michael

  16. #16
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Using List boxes and text boxes with complex data sets

    What I was expecting is the result from ListBox2 to enter the master sheet within Row27 in the relevant row in one cell. Currently nothing is there.

    I'm sure its something silly, I would really appreciate if you could help
    Michael

  17. #17
    Registered User
    Join Date
    11-06-2016
    Location
    Oman
    MS-Off Ver
    2007
    Posts
    11

    Re: Using List boxes and text boxes with complex data sets

    Need Spell Currency To Convert To Rial Omani

  18. #18
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Using List boxes and text boxes with complex data sets

    vbLf is the constant for Line Feed character, so it should add multiple lines if multiple items are selected in listbox2.
    If you unprotect Master sheet and format col.AA "Wrap text", you will see the contents in the cell.

  19. #19
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Using List boxes and text boxes with complex data sets

    OOps..
    Should be
    Please Login or Register  to view this content.
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Using List boxes and text boxes with complex data sets

    Hi Jindon

    The master sheet is still not updating with the string of items from ListBox2, any ideas of what else is missing?

    I've just tested on your sheet attached and its the same result

    Many thanks
    Michael

  21. #21
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Using List boxes and text boxes with complex data sets

    It is updating.

    Do you really understand what is does?

  22. #22
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Using List boxes and text boxes with complex data sets

    Hi Jindon

    When selecting ok on the user form, the items inserted from ListBox1 to ListBox2 should write the items in ListBox2 into the 27th column of the master worksheet, currently this is not working on either spreadsheet.

    The following writes beautifully

    Please Login or Register  to view this content.
    However the following is not writing the content of itself as a string to the 27th column in the "master' worksheet

    Please Login or Register  to view this content.
    What am I missing?

    Many thanks

  23. #23
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Using List boxes and text boxes with complex data sets

    1) Select PAP123 fom Combobox, studyID should be EDBBV10065 and it is in A65 in Master Sheet.
    2) Copy some items to ListBox2 from ListBox1 and select item(s) in ListBox2.

    It should update AA65 according to the items selected in ListBox2.

  24. #24
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Using List boxes and text boxes with complex data sets

    Hi Jindon

    Thats the thing, its not updating on myside for some reason? AA65 in this example is blank

  25. #25
    Registered User
    Join Date
    03-16-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Using List boxes and text boxes with complex data sets

    Hey,

    I've just played with the check / uncheck all. This seems to work when selected. Is there anyway to by-pass this at the writing to 'Master'sheet state? The reason being the CheckBox was to move large date from ListBox1 and ListBox 2

    Thanks
    Michael

  26. #26
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Using List boxes and text boxes with complex data sets

    Oops typo, it should be A46, not A65. so it updates AA46.

+ 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. Lossing Chart Boxes/ Text boxes when close file
    By david2003 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 11-05-2014, 09:39 AM
  2. populating list boxes and combo boxes in a user form.
    By ahceinaej in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2014, 11:54 AM
  3. Selected data from combo boxes to text boxes
    By soulun in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-22-2013, 06:48 AM
  4. Replies: 7
    Last Post: 09-09-2011, 12:12 PM
  5. Auto populating UserForm Combo and Text boxes from Validated data sets
    By ZIXILPLIX in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2010, 12:55 AM
  6. Replies: 2
    Last Post: 02-19-2010, 03:55 PM
  7. [SOLVED] Selecting subsets using combo boxes or list boxes
    By CLamar in forum Excel General
    Replies: 0
    Last Post: 06-01-2006, 02:45 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