+ Reply to Thread
Results 1 to 9 of 9

User form not finding object

  1. #1
    Registered User
    Join Date
    11-03-2021
    Location
    Devon, England
    MS-Off Ver
    office 365
    Posts
    11

    User form not finding object

    Hi

    I am having trouble adapting a userform code from a previous workbook (help found on here to get that one working), i am trying to get it to initialize when the workbook is opened and to add a line and populate a table with user input, plus add a line to the table on the next worksheet and populate relevant cells,
    Heere is my tinkered code

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,912

    Re: User form not finding object

    I believe that this:

    Please Login or Register  to view this content.
    is meant to be this:

    Please Login or Register  to view this content.
    Rory

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

    Re: User form not finding object

    see attached for code corrections - to be able to loop through the textboxes you can not rename them and expect a result.
    note the order has to be in the sequence order of the table columns.
    if you want the form to show on opening the workbook then put code in 'ThisWorkBook' module 'Private Sub WorkBook_Open() event (Newentry.Show)
    Last edited by torachan; 11-08-2021 at 07:45 AM.
    Torachan,

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

  4. #4
    Registered User
    Join Date
    11-03-2021
    Location
    Devon, England
    MS-Off Ver
    office 365
    Posts
    11

    Re: User form not finding object

    Thank you so much that is twice you have helped me with user forms, would i be able to copy the submit code and change to WS2 to paste in the same cells on the second worksheet?
    Last edited by Nialc00p3r; 11-09-2021 at 06:01 AM. Reason: spelling

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

    Re: User form not finding object

    In the attached I have annotated the code that will pass the values to Sheet2.
    Also placed on the form a multipage (you can use each page as a separate form), this save having multiple UserForms and makes passing variables between each.
    You will note the labels and textboxes are simply named and in sequence order as per the table columns on sheet2 - then all the referencing can be looped - save long names and many rows of individual code.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-03-2021
    Location
    Devon, England
    MS-Off Ver
    office 365
    Posts
    11

    Re: User form not finding object

    Hi torachan, sorry to bother you again, is there a way to get the user form to populate the first 8 columns on ws2 at the same time?

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

    Re: User form not finding object

    The first form (your original) also populates Sheet2 as well (all though you only have seven common columns on this sheet)

  8. #8
    Registered User
    Join Date
    11-03-2021
    Location
    Devon, England
    MS-Off Ver
    office 365
    Posts
    11

    Re: User form not finding object

    Hi Tora, thank you so much for your help with this, i have edited the original workbook and it is writing how i want it to, the only issue i have now is the date on the second worksheet is mixing the day and month up, i cant see anything in the code that has changed and it writes to the first sheet with no issues

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

    Re: User form not finding object

    on your submit button find the code below and add it 'isdate' extra lines.
    Please Login or Register  to view this content.

+ 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] VBA User Form finding cells
    By Tapion342 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-25-2015, 06:57 PM
  2. VBA Insert PDF File as an Object using User Form
    By Eng.Hashem in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-25-2015, 08:12 AM
  3. [SOLVED] Variable User-form object name
    By sur4j in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-12-2014, 10:27 AM
  4. Replies: 4
    Last Post: 03-27-2013, 12:41 PM
  5. Collection of object control during Initializing user form
    By krish_kg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2009, 05:39 AM
  6. Finding out which box on a user form has focus
    By duckboy1981 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-16-2009, 06:25 AM
  7. [SOLVED] User form Object corruption
    By Datasort in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-19-2006, 03:20 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