+ Reply to Thread
Results 1 to 10 of 10

UserForm: Textbox value load according to drop down list

  1. #1
    Registered User
    Join Date
    04-30-2014
    Location
    england
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    63

    UserForm: Textbox value load according to drop down list

    Hi gurus,

    I have a userform that I need it to load the value in the textbox according to the dropdown list

    For example:
    If outlet ABC selected, it 3 textbox need to show the value in same row of ABC outlet.

    Beside that, there is two button I need it to function as well

    Save button:

    Save the textbox value according to the drop down list selected

    For example, ABC outlet selected and there if there is a changes of any 3 textbox, say Promoter name change from David to Dave the save button need to save according to the cell selected

    Delete button:

    Need to delete whole row of selected outlet

    Please refer attached file: New Book.xlsm

    May I know how to achieve this?

    Thank you.

  2. #2
    Registered User
    Join Date
    04-30-2014
    Location
    england
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    63

    Re: UserForm: Textbox value load according to drop down list

    i found this more or less the same situation from:

    http://stackoverflow.com/questions/2...using-named-ra

    and I modify it to suit my current condition:
    Please Login or Register  to view this content.
    but it seems doesnt work with my multiple textbox

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: UserForm: Textbox value load according to drop down list

    Hi lazyserv,

    Find the attached where I've triggered your userform by a double click in Column A. Then look at the code behind the Setup form for the On_Change code. Each time you change the combo dropdown it will refresh the data. You can also now change an outlet name and it will add it to the list when you click on the save button.

    I hope this little example gives you some ideas on how to use uerforms and their events.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    04-30-2014
    Location
    england
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    63

    Re: UserForm: Textbox value load according to drop down list

    Hi MarvinP

    May I know is it possible for it to load on the form Load?

    Currently I need to double click column A to show the form.

    Can change it to when I click a button that use Macro to call the form?

    For example: I create a button name Show Form

    Please Login or Register  to view this content.
    Once the form load it will show default ABC outlet.

  5. #5
    Registered User
    Join Date
    04-30-2014
    Location
    england
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    63

    Re: UserForm: Textbox value load according to drop down list

    In addition:

    How do I save the code to Accounting format for this code row?
    I already set the whole row in Accounting format

    Please Login or Register  to view this content.
    Currently when Initialize I set the format to load as Currency style

    Please Login or Register  to view this content.
    But when I save the form it show as number instead of accounting format

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: UserForm: Textbox value load according to drop down list

    Try this one.

  7. #7
    Registered User
    Join Date
    04-30-2014
    Location
    england
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    63

    Re: UserForm: Textbox value load according to drop down list

    it work like charm, but it doesn't save the cost as accounting format

    it just save as number, if you look at the book all the cost was set to accounting format

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: UserForm: Textbox value load according to drop down list

    I don't quite understand what you want with "save in accounting format".

    Maybe the text needs to be changed to numbers before saving? 6 the number and 6 the letter both look the same to us but Excel treats them differently. Perhaps a convert to number using VBA is what you need somewhere in your code? Perhaps a .Value or CDec() is needed on that last textbox before you stick it back on your worksheet?

  9. #9
    Registered User
    Join Date
    04-30-2014
    Location
    england
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    63

    Re: UserForm: Textbox value load according to drop down list

    My apologize, I didnt notice the code should end .Value

    I added the code and now it work like charm!

    Thanks and +rep for solving my problem.

    Thank you!!!

  10. #10
    Registered User
    Join Date
    04-30-2014
    Location
    england
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    63

    Re: UserForm: Textbox value load according to drop down list

    Quote Originally Posted by MarvinP View Post
    Try this one.
    Hi MarvinP

    May I know how can I delete the whole row based on the drop down list selected?

+ 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. Replies: 11
    Last Post: 01-20-2015, 09:34 AM
  2. Userform List of Textbox names
    By Isaaq in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-27-2014, 10:28 AM
  3. Replies: 2
    Last Post: 02-08-2014, 01:24 PM
  4. [SOLVED] Load last cell in Column C to Userform Textbox
    By Nu2Java in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2012, 10:22 AM
  5. Load list of ftp files from directory into a userform?
    By ddanfleetwood in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-02-2010, 02:03 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