+ Reply to Thread
Results 1 to 11 of 11

Code to Initatiate Userform workeb but now I get Run Time 381

  1. #1
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Code to Initatiate Userform workeb but now I get Run Time 381

    The strangest thing has happened. I have simple Userform.Show codes in a module which I have assigned to shapes on a spreadsheet. Some of them still work but others throw a Run Time 381 Error Code?

    Any suggestions.

  2. #2
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Code to Initatiate Userform workeb but now I get Run Time 381

    bump for help

  3. #3
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Code to Initatiate Userform workeb but now I get Run Time 381

    Need to have a look..
    So

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  4. #4
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Code to Initatiate Userform workeb but now I get Run Time 381

    DRAFT PLT-50-B Contractor Variance Database.xlsm

    See above attached file.

    Essentially when you enter be sure you are on worksheet "Home" and click on the dashboard text that says "Print Variance" (i.e. this is actually an object with an assigned macro) The macro itself is just to stimulate a userform but at this point is currently not working....???? at a loss as to why.

  5. #5
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Code to Initatiate Userform workeb but now I get Run Time 381

    Quote Originally Posted by Vikas_Gautam View Post
    Need to have a look..
    So

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Added attachment sorry I forgot to quote before.

  6. #6
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Code to Initatiate Userform workeb but now I get Run Time 381

    see UserForm CVF14
    Please Login or Register  to view this content.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  7. #7
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Code to Initatiate Userform workeb but now I get Run Time 381

    Quote Originally Posted by john55 View Post
    see UserForm CVF14
    Please Login or Register  to view this content.
    John,

    I guess I am somewhat confused....so you are saying that the previous activate code for userform CVF14 was not allowing it to initiate?

    Also try the "Edit Variance" or "Approve Variance" at the top of the dashboard as they are encountering the same problem.
    Last edited by jaredmccullough; 03-09-2015 at 08:21 AM.

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

    Re: Code to Initatiate Userform workeb but now I get Run Time 381

    There's only one value in column A on the sheet 'Variance Database'.

    To populate a listbox with a single value you need to use AddItem instead of List.

    So try this code for the form's Initialize event.
    Please Login or Register  to view this content.
    PS Don't seem to have a problem with Edit Variance but you can use the above code for Approve Variance.
    If posting code please use code tags, see here.

  9. #9
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Code to Initatiate Userform workeb but now I get Run Time 381

    Quote Originally Posted by Norie View Post
    There's only one value in column A on the sheet 'Variance Database'.

    To populate a listbox with a single value you need to use AddItem instead of List.

    So try this code for the form's Initialize event.
    Please Login or Register  to view this content.
    PS Don't seem to have a problem with Edit Variance but you can use the above code for Approve Variance.
    Norie,

    Thank you as I was unaware of this requirement so just to clarify if (1) item it needs to be AddItem instead of List?

    What is the cause for this requirement?

    Jared

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

    Re: Code to Initatiate Userform workeb but now I get Run Time 381

    Jared

    I believe it's because a range consisting of more than one value will return an array whereas a range of only one value will only return the value.

  11. #11
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Code to Initatiate Userform workeb but now I get Run Time 381

    Hi
    Norie is right!
    I saw that you have one item in column A, so initially I tested it with more items (such as "aaa", "bbbb", etc) and it worked.
    I wish you success!

+ 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. Userform Combobox - select from list, store this as default each time userform loads
    By thecdnmole in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-19-2014, 07:48 AM
  2. Exit Userform to return to main code, but keep userform open
    By jombler74 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 09-04-2014, 04:01 AM
  3. UserForm help - display list of open workbooks except workbook userform code is in
    By kensweep in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-09-2014, 12:26 PM
  4. [SOLVED] Userform code fails when the userform is called from a custom ribbon button
    By klonbeck in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-14-2013, 03:00 PM
  5. First time UserForm user, need help coding my userform so I can collect data.
    By Crunketh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-14-2013, 02:40 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