+ Reply to Thread
Results 1 to 6 of 6

Need help in code to overwite existing data from userform

  1. #1
    Registered User
    Join Date
    12-01-2014
    Location
    DubaI
    MS-Off Ver
    MS 7
    Posts
    10

    Need help in code to overwite existing data from userform

    Hi, I am fairly new to this forum and to VBA.
    I have created a userform to recall data from Excel Sheet ("Prospects") in a numnber of fields (textbox, combobox, etc.)
    the command button to call the data to userform is CommandButton1

    I would like to add another command that will allow me to change/edit certain cell containts and overwite the existing ones... Thank you so much for your help
    the code I am using is:

    Please Login or Register  to view this content.
    Last edited by MedSter2015; 12-01-2014 at 11:10 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need help in code to overwite existing data from userform

    I would like to add another command that will allow me to change/edit certain cell containts and overwite the existing ones...
    For instance?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    12-01-2014
    Location
    DubaI
    MS-Off Ver
    MS 7
    Posts
    10

    Re: Need help in code to overwite existing data from userform

    Quote Originally Posted by JBeaucaire View Post
    For instance?
    Thanks JBeaucaire
    In fact, the above code retrieves data from a sheet (all related info are stored in the same row). for example, I enter a client name, contact, email, etc.
    I have written the above code to retrieve this info from the excel sheet and display it in the userform (data called by pressing on CommandButton1).
    Once the data is called into the userform, I can change some entries, amend, add new info (in pre-set set of columns) and then I would like a code that will allow me re-saving these amended data by overwriting the existing one. so the code should be linked to the lookup function of the above one.

    I am not sure if my explanation is too confusing...

    Thanks for your help.
    PS: the code i use to enter the data in first place is

    Please Login or Register  to view this content.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need help in code to overwite existing data from userform

    I see in the second macro you do a line by line check for the prospect (the LOOP) and popup a msgbox warning of duplicates. Instead of that warning, just note that row number where the prospect was found and exit the loop. If you reach the end of the data you can note the next empty row instead. Then your macro continues normally.

  5. #5
    Registered User
    Join Date
    12-01-2014
    Location
    DubaI
    MS-Off Ver
    MS 7
    Posts
    10

    Re: Need help in code to overwite existing data from userform

    Thanks a lot, figured out a code that works as below.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need help in code to overwite existing data from userform

    As it appears you've reached a conclusion, I've marked this thread SOLVED for you.
    FYI, this is done through the Thread Tools located above the first post in this thread. Thanks.

+ 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. [SOLVED] Userform to add data to existing database based on unique alphanumerical code
    By MooseAUH in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2014, 10:55 AM
  2. List existing data in a UserForm Textbox and then be able to change the data.
    By gnaske in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-01-2013, 02:01 PM
  3. Adding Code to an Existing UserForm with VBA
    By JimmyA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-08-2010, 12:02 PM
  4. Replies: 1
    Last Post: 08-15-2009, 05:52 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