+ Reply to Thread
Results 1 to 11 of 11

List existing data in a UserForm Textbox and then be able to change the data.

  1. #1
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    List existing data in a UserForm Textbox and then be able to change the data.

    I have a worksheet with existing data.

    Look the attached picture
    Data to textbox.jpg

    When I open the UserForm, I want to list the existing data from the worksheet in the Textboxes and then be able to change the value, when clicking the button "Insert data".
    If I only change a single of the data value, it should keep all the other existing data.

    Look the attached picture
    Textbox.jpg


    Can anybody help me making a code:
    1. List the existing data in the Textboxes, when the UserForm open.
    2. Insert new data and keep the old I don't change, when clicking at the button "Insert data".

    Thank you in advance.

    Ib

  2. #2
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: List existing data in a UserForm Textbox and then be able to change the data.

    can you post the workbook so we can see the code? otherwise we have to rewrite your code and that takes too long?

    basically you have to tell excel to get the value from the cell (example: Sheet1 (or what ever the sheet name), B1=2012)
    so let's say your corresponding text box name is Ar.text (could be textbox1.text or something)
    you would have
    Please Login or Register  to view this content.
    the code should be before the form.show command

    and you would do that for all your cells and corresponding textboxes, then when you open the form it will have those values. When you hit "Indsaet data" (insert data) it will populate the cells on your sheet with the values in the textboxes showing on your form.

    p.s. i'm always amazed that Danish people always seem to have perfect english. you only had 2 grammar errors; a native english speaker usually has more!!

    p.p.s. you don't need to bother with CAPITAL letters on a forum, it's a waste of time

  3. #3
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Re: List existing data in a UserForm Textbox and then be able to change the data.

    I didn't made a code.
    I actually don't know how to do it !!

    The worksheet is attached.
    - 3 cells to the left in the top.
    - 3 cells to the left in the bottom.
    - 10 cells to the right.

    The UserForm is called Indstil_Ark in the VBA module Forms.

    p.s. Thank you - I try hard to speak and write English, although it's a bit difficult for me

    p.p.s. I'll try to remember about the capital letters, but I find it natural to write in this way - I always do
    Attached Files Attached Files
    Last edited by gnaske; 04-28-2013 at 03:40 AM.

  4. #4
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Re: List existing data in a UserForm Textbox and then be able to change the data.

    Scott.

    I will appreciate if you can make a code to the first textbox in the userform, called År + the Done Button called Indsæt data.
    Then I believe I can fill in the rest of the codes.

    Ib

  5. #5
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Re: List existing data in a UserForm Textbox and then be able to change the data.

    Hi again Scott.

    I had now made the worksheet with the codes as you told, except the Insert Button.

    New worksheet attached.

    The code's is in the VBA module.
    The worksheet have it's own ribbon and when you click at the button, it open the UserForm.
    But I can't get it work
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: List existing data in a UserForm Textbox and then be able to change the data.

    i'm looking at it now, with the time difference from denmark to seattle i hope you dont have to wait too long

  7. #7
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Re: List existing data in a UserForm Textbox and then be able to change the data.

    Hi Scott.

    It's okay and maybe I'll not see your answer right away, because I soon need to go to bed, to get at work very early monday morning.
    But I'll see forward to your answer and to see if you can solve this problem for me

  8. #8
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: List existing data in a UserForm Textbox and then be able to change the data.

    wow, i was having trouble because i've never worked with a custom toolbar to run a macro. I had to make some minor changes to the code so it will call a second macro to input the data from Ark1 to the form, then when you click "Indsaet data" it writes the updated info back to Ark1

    if you want the form to close after you hit "Indsaet data" then use
    the Unload Me line right before the End Sub line of Private Sub IndsaetData_Click()
    hopefuly everything works as you desire
    Textbox try2.xlsm

  9. #9
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Re: List existing data in a UserForm Textbox and then be able to change the data.

    Hi Scott.

    Thank you very much - It works.

    But I'm not sure I can use it, because the worksheet is a test sheet to a much bigger and more complex worksheet with it's own ribbon and a lot of userforms, I'm trying to build.
    The worksheet is for a lot of users and the data you see in the test sheet is some of the main settings in the big worksheet.

    My intention was to let the users work in the userform instead of in the tab and then I could hide the tab totally.
    Using my own ribbon, I can hide Excel's own ribbon for the users, which prevent them to mess up in the worksheet.
    And I can of course show the Excel ribbon too, with a password protected button in my own ribbon, if I want to edit in the worksheet.
    I know I just can lock the cells, to prevent other to mess up in the worksheet, but it was funny to make the show/hide Excel ribbon

    I should actually use the show data code and change the value in other userforms too.


    I had attached a Textbox try3.
    I use your codes in each textbox and when you write something, you'll see it change in the worksheet in real time too.
    At the "Done" and "Quit" button I just use Unload Me, but I could actually do it with only one "Finish" button.

    What I need is a code before your code and in each textbox, which can show the data, when the userform open.
    And when changing the data, it will change in real time.
    Then I can use the textbox code in other userforms too.
    I hope you can help me.


    The big worksheet is to big to send here, but if you're interested, you can send me a mail and I'll forward it to you, although I'm not sure you understand anything, because all the text in the worksheet is in Danish.
    If you send me a mail, then please write Scott from Excel Forum or something like that in the subject line.
    I get a lot of spam and then I'll see it

    My mail: iha@live.dk


    Until now, thank you for all your help.
    I'm not very good in VBA coding, but I'm trying and learning all the time
    I hope to hear from you again.

    Ib
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Re: List existing data in a UserForm Textbox and then be able to change the data.

    Show/Hide Excel ribbon
    Attached Files Attached Files

  11. #11
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: List existing data in a UserForm Textbox and then be able to change the data.

    Textbox try3.xlsmk, i added back the ability to update the cells as you type in the textboxes

+ 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