+ Reply to Thread
Results 1 to 17 of 17

Edit Data through UserForm

  1. #1
    Forum Contributor
    Join Date
    10-28-2011
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    114

    Question Edit Data through UserForm

    Hi

    I have a userform that currently adds data to a worksheet and I was looking to add in an 'edit' button.- not sure about the coding

    The fields that can be edited are:
    - Requirement
    - Name
    - Agreed costs
    - Supplier Costs

    I would like the edit button to edit the existing data, so it will look up the requirement first in column A, then replace the 'name', 'agreed costs' and 'supplier costs' in that row.

    I have attached an example on how the data will be stored.

    Appreciate your support.

    Thanks.
    Attached Files Attached Files
    Last edited by sgp; 11-11-2011 at 05:40 AM.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Edit Data through UserForm

    Hi sgp

    It would be helpful if your attachment included the UserForm AND the existing code.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Forum Contributor
    Join Date
    10-28-2011
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Edit Data through UserForm

    Please see attatchment.

    Thanks.
    Attached Files Attached Files

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Edit Data through UserForm

    Hi sgp
    Can/will a given requirement (eg: Requirement 5) appear multiple times in Column A? If so, can/will those multiple instances have the same Preferred Supplier or could the Preferred Supplier be different?

  5. #5
    Forum Contributor
    Join Date
    10-28-2011
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Edit Data through UserForm

    Hi jaslake,

    A Requirement can only appear once in column A, however the preffered supplier could change over time.

    Thanks for your time!

  6. #6
    Forum Contributor
    Join Date
    10-28-2011
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Edit Data through UserForm

    Would it be possible if a Contract Requirement could be added and edited through one button?

    I.e. if a requirement does not exist in column A then the data is added and if a requirement does exist in column A then the information is edited.

    E.g. Requirement 5 exists therefore information can be edited in that row, Requirement 9 does not exist so it can be added below.

    Coding exist in the UserForm attached in previous posts, may need some tweaking!

    Many Thanks!

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Edit Data through UserForm

    Hi sgp

    Try the code in the attached. Let me know of issues.
    Please note the code requires a reference to Microsoft Scripting Runtime...Tools > Reference > Microsoft Scripting Runtime
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    10-28-2011
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Edit Data through UserForm

    Hi jaslake

    That seems to be working well..thanks a lot for your help, much appreciated!!

    The only problem i'm having is that the column 'Supplier Costing' may move across if more 'RPI years’ are added, in my previous coding the column 'Supplier Costing' is searched then the costing is recorded below.

    Could something like this be incorporated??

    Many thanks, you’ve been a great help!

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Edit Data through UserForm

    Hi sgp

    Regarding this
    The only problem i'm having is that the column 'Supplier Costing' may move across if more 'RPI years’ are added, in my previous coding the column 'Supplier Costing' is searched then the costing is recorded below.
    Could something like this be incorporated??
    Sure can...give me a bit of time...may not be tonight.

  10. #10
    Forum Contributor
    Join Date
    10-28-2011
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Edit Data through UserForm

    No worries that’s absolutely fine!! - I will examine the great coding you have done!

    ..also just to let you know that 'Supplier Costing' column may not always be the last column.

    Thanks!!

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Edit Data through UserForm

    Hi sgp

    This should NOT be an issue...the procedure is looking for "'Supplier Costing" regardless of where it's located.
    Try the code in the attached...beat it up...let me know of issues.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    10-28-2011
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Edit Data through UserForm

    That's BRILLIANTTT!!

    Works really well, thanks for your help!


  13. #13
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Edit Data through UserForm

    Hi sgp

    In response to your PM I'm posting the revised code
    Please Login or Register  to view this content.
    Let me know of issues.

  14. #14
    Forum Contributor
    Join Date
    10-28-2011
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Edit Data through UserForm

    Thanks jaslake, works really well!..appreciate your time!

  15. #15
    Forum Contributor
    Join Date
    10-28-2011
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Edit Data through UserForm

    Hi jaslake,

    I did say the code works well but I have identified a problem with validations..(sorry!)...if I try adding a new requirement by filling in all the required information then the msgbox "A Value Required In All Feilds" still shows up...

    However the validations work fine when updating requirements.

    Thanks for your support.

  16. #16
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Edit Data through UserForm

    Hi sgp

    'Course it does
    if I try adding a new requirement by filling in all the required information then the msgbox "A Value Required In All Feilds" still shows up...
    That's the way the code is written Sorry 'bout that...try this
    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    10-28-2011
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Edit Data through UserForm

    Thank you so much jaslake, couldn't ask for more!!!! - You've been a great help!!

    Thanks!

+ 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