+ Reply to Thread
Results 1 to 7 of 7

Userforms and cell updates in Excel 2010

  1. #1
    Registered User
    Join Date
    01-29-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Post Userforms and cell updates in Excel 2010

    I have the following code and keep getting "run-time error '9'. what am i doing wrong?
    Please Login or Register  to view this content.
    Last edited by vlady; 07-02-2014 at 07:48 PM.

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Userforms and cell updates in Excel 2010

    That's because once the activate event is over, the program loses the value of SB and M.

    Then, in the subsequent Exit events, you're trying to refer to a object that hasn't been declared or defined.

    It's call the scope of variables and procedures. It's worth a read.

    However, the code can be simplified and the problems of scope are resolved.

    Please Login or Register  to view this content.
    David
    (*) Reputation points appreciated.

  3. #3
    Registered User
    Join Date
    01-29-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Userforms and cell updates in Excel 2010

    thanks for the code, however, I am still getting the same error. when I check the debugger, it stops on the 1st line:
    txtSnowball.Text = Worksheets("Sheet1").Range("C31")
    Any ideas?

  4. #4
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Userforms and cell updates in Excel 2010

    I just ran a sample on my machine and it worked.

    In that case, the worksheet name must be wrong.

  5. #5
    Registered User
    Join Date
    01-29-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Userforms and cell updates in Excel 2010

    that was the problem. It works great now. I was using the sheet reference instead of the name "Balances".

    I have another question for you... How can I format the textbox in "currency" format?

    thanks again,

  6. #6
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Userforms and cell updates in Excel 2010

    When you stuff the textbox, you have to use the Format Function.
    Please Login or Register  to view this content.
    And when you push it back, you will need to use
    Please Login or Register  to view this content.
    to strip out the currency sign.

    Textboxes are just that. Text (or strings) and you have to treat them accordingly.

  7. #7
    Registered User
    Join Date
    01-29-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Userforms and cell updates in Excel 2010

    that worked great. thanks

+ 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. Data updates in Sheet2 when there are updates in sheet1
    By pal004 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2014, 10:20 AM
  2. How to paste special in Outlook 2010 from a copied cell in Excel 2010
    By Baldowsky in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 05-30-2014, 11:40 AM
  3. Replies: 0
    Last Post: 05-14-2013, 02:00 PM
  4. Replies: 0
    Last Post: 07-29-2011, 07:19 AM
  5. Replies: 3
    Last Post: 03-04-2011, 06:01 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