+ Reply to Thread
Results 1 to 7 of 7

Codes in userform no longer working

  1. #1
    Forum Contributor
    Join Date
    03-04-2014
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2019
    Posts
    756

    Codes in userform no longer working

    Hello,

    I have created a userform to aid with data entry into excel.

    I have a number of textboxes, which have the same code (obviously with changes to textbox number and cell etc):

    Please Login or Register  to view this content.
    These worked fine, but now when I run the Userform and click into the TextBox to enter a word I get an 'Object required' error with the single line of code highlighted:

    Please Login or Register  to view this content.
    I have recently added another userform, so is this why this coding is no longer working?

    Please please help!

    Many thanks,

    Chris

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Codes in userform no longer working

    May be Report sheet (the programmatic name) is not the same ..
    Try add Me before textbox1 in that way

    Please Login or Register  to view this content.
    Or it is better to upload sample of your workbook to have a look
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: Codes in userform no longer working

    Check to make sure you still have a worksheet with the codename Report. The codename is not the name visible to the user on the tab, it's the name shown in the VBA code development window. (We can help faster if you attach your file.)

    Also, if all you are doing is copying the textbox every time there is any kind of change, then it would be easier to link the textbox directly to the cell using the ControlSource property. Open the userform development view, click on the textbox, hit F4, then go to the controlsource property and type in

    Report!A2

    assuming that "Report" is the sheet name appearing in the tab (NOT the codename that I mentioned above!)

    If you do that, you no longer need to do this in the code.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Contributor
    Join Date
    03-04-2014
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2019
    Posts
    756

    Re: Codes in userform no longer working

    Hi guys,

    Please see the attached.

    Many thanks
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Codes in userform no longer working

    Unless you have edited the sheet Code Name that code could not have worked as you have no worksheet with a Code Name of 'Report' - but you do have a worksheet with a Tab Name of 'Report'.

    As mentioned by 6StringJazzer change the Code Name for Sheet3 (Tab name: Report) to 'Report'

    There are advantages to doing that. The main one being it prevents code errors if the user should change Tab Name...
    Please Login or Register  to view this content.
    Also, you may not need to define Worksheet objects as you can refer directly to them using the code name. The declaration for ws (in the quoted line above) could be removed as could that line itself. Then when assigning to the bookmarks you'd simply use

    Please Login or Register  to view this content.
    Last edited by cytop; 07-16-2017 at 11:20 AM.

  6. #6
    Forum Contributor
    Join Date
    03-04-2014
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2019
    Posts
    756

    Re: Codes in userform no longer working

    Hi guys,

    Thanks for the responses. How do I go about changing the codename of sheet3 then?

    Many thanks,

    Chris

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: Codes in userform no longer working

    Go to the VBA development window and click on the sheet name. Hit F4. The first property in the list will be the codename, which you can simply overtype.
    codename.jpg

+ 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. From Excel working to Google Sheets no longer working
    By rad1964 in forum Excel General
    Replies: 5
    Last Post: 07-19-2016, 10:23 PM
  2. [SOLVED] Buttons No Longer Working
    By SHUTTEHFACE in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-15-2014, 05:26 PM
  3. Active X no longer working on some PC's
    By spinkung in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-15-2014, 01:14 PM
  4. VB Code no longer working
    By buttercup1227 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2014, 10:38 AM
  5. [SOLVED] Macro no longer working?
    By Margate in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2013, 02:26 PM
  6. vba web query no longer working
    By Cicada in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-21-2011, 07:56 PM
  7. Autorank - no longer working
    By Larph in forum Excel General
    Replies: 2
    Last Post: 08-01-2010, 06:57 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