+ Reply to Thread
Results 1 to 10 of 10

Edit existing data in spreadsheet through userform textbox

  1. #1
    Registered User
    Join Date
    05-16-2011
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2007
    Posts
    29

    Edit existing data in spreadsheet through userform textbox

    Hi all

    I'm back again with more problems !

    I have a userform with 30 textboxes on it where users input data to a spreadsheet. On the userform I have a spin button that allows the user to scroll through and view the data through the userform. Is there anyway they can edit data in a textbox ( any of them ) and that will overwrite what was in the cell in the spreadsheet

    Thanks in advance
    Miff3436

  2. #2
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Edit existing data in spreadsheet through userform textbox

    Yes, you can do it like this

    Please Login or Register  to view this content.
    Please take time to read the forum rules

  3. #3
    Registered User
    Join Date
    05-16-2011
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Edit existing data in spreadsheet through userform textbox

    Hi Steffen

    Thanks for your time ! I'm quite new to Vba so you may have to bear with me. The first two lines of code do they go in the userform inialize ?

    I can't work out the range set to C2 either as it could be any cell in the spreadsheet that may need to be edited. Looking forward to your response


    Thanks again
    Miff3436

  4. #4
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Edit existing data in spreadsheet through userform textbox

    The textboxes, 30 of them. Should edit a cell each, right, else how should the textbox know wich cell to edit?

    Try uploading a sample workbook.

  5. #5
    Registered User
    Join Date
    05-16-2011
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Edit existing data in spreadsheet through userform textbox

    Hi Steffen

    Sorry my description was a bit fague. I have attached a small sample of what i am trying to achieve. When the user scrolls through the form using the spin button i would like them to be able to update what ever text box they like that is showing in the userform, which means it could be 100+ rows down and 30 columns across. The user does not have access to the worksheet behind. I have a button on the original userform that allows the user to complete a blank form and add but not edit. Even if i had a command button that allowed the user to edit records.


    Is this possible ?

    Thanks for your time once again i know it must be frustrating working with newbies

    miff3436
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Edit existing data in spreadsheet through userform textbox

    Hi,

    Try this.

    When ever you leave a checkbox in the userform, it test's if anything have been changed, if it has it updates the correct cell in the sheet.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-16-2011
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Edit existing data in spreadsheet through userform textbox

    Hi Steffen

    That works perfectly in the attachment as is exactly what i am after, Thank You

    Here is where my inexperience shows as i cannot get it to work in my userform/worksheet. Can you see where i am going wrong as i am so close thanks to your help

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Here is the code you done for me. The only difference i have made is that i have changed the exit event worksheet from 2 to my named sheet and the name of the text boxes

    Please Login or Register  to view this content.
    Thanks In advance
    miff3436

  8. #8
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Edit existing data in spreadsheet through userform textbox

    Hi,

    This was the code i made for you that worked

    Please Login or Register  to view this content.
    As you can se at the top you need to have two Public variables and an exit + enter event for each textbox.

    All the code is pasted into the userform code module.

  9. #9
    Registered User
    Join Date
    05-16-2011
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Edit existing data in spreadsheet through userform textbox

    Hi Steffen

    Got it !!! Just me rushing and forgetting fields. Not sure why it never have me error or debug but sorted now . Brilliant response thanks for your time and knowledge.


    Thanks
    Miff3436

  10. #10
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Edit existing data in spreadsheet through userform textbox

    Your welcome, glad i could help.

    Remember to mark the thread as solved.

+ 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