+ Reply to Thread
Results 1 to 5 of 5

Write textbox value to cell 'on-the-fly'

  1. #1
    Registered User
    Join Date
    08-08-2006
    Posts
    25

    Write textbox value to cell 'on-the-fly'

    Apologies if this is a repeat question, but being only a beginner in VB and lack of success on google and forum searching I've had no choice

    I have a userform with 4 text boxes. When the user enters a value in textbox 1, I need that value to be written to cell A1.

    Cells A2, A3 and A4 have formulas linking to cell A1, and the values are then respectively displayed in the text boxes in the userform. The user can then submit the details as they are (to another sheet) or modify the calculated values if neccessary.

    In practice, this is for retail price (user entry); (less 20%, less VAT, and VAT values are calculated)

    Many thanks

    Alex

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    If you look in the Properties of the TextBox you will see ControlSource. Type into that box Sheet1!$A$.This will link TextBox to A1 on sheet1.Whatever you enter in A1 will be displayed in Textbox1, and vice versa.

    However, it is unnecessary, you can do your calculations within VBA, eg this will calculate 20% of Textbox1's value & display the result in Textbox2. Note it uses the textbox_exit event to trigger the calculation

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    08-08-2006
    Posts
    25
    Many thanks royUK. That's the far easier route I was hoping for but thought wasn't possible!
    Thanks Again

    Alex

  4. #4
    Registered User
    Join Date
    08-08-2006
    Posts
    25
    Actually, having tried that out in more detail, is it possible to 'swap' the method:

    i.e. On exit of textbox1, the value 'textbox1*0.2' is written in textbox 2?

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    yes just amend the code.

    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)

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