+ Reply to Thread
Results 1 to 2 of 2

I'm Stuck...Userform / Command Button export to worksheet in same workbook

  1. #1
    Registered User
    Join Date
    07-14-2014
    Location
    Stamford, CT
    MS-Off Ver
    2007
    Posts
    16

    Thumbs down I'm Stuck...Userform / Command Button export to worksheet in same workbook

    Please Login or Register  to view this content.
    The above is my code when the command button on a userform is clicked.

    The code in Green text works fine. If the value that is entered in textbox1 is not found in column A then a new row/record is created.

    Problem is when I am trying to update an existing record, meaning if a value is found in Column A, it should update the referenced column in the same row of the found/matched record in column A. The problem with the code above is that if one enters values in the userform after textbox2 and doesn't update the preceding textbox/combobox then it won't populate (meaning having an update for textbox5 and having no values in the preceeding control fields). I think it is an issue with the active cell reference? If the preceding userform/combobox is not populated the activecell gets screwed up? I have tried offsets etc to no avail. If just textbox9 has an update then I need the code to find the match row=value in column A and then populate the referenced column of that row.

    Another requirement for updating is that if nothing is entered in a textbox/combobox then it will not update with BLANK/No value and remove a field value that was entered earlier.


    Any help is so appreciated.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: I'm Stuck...Userform / Command Button export to worksheet in same workbook

    If match is found then Variable Found returns a range.
    You have to refer to the row of that variable meaning instead of using activecell.row you have to use Found.Row
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

+ 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] Filter and Export Data to CSV Text File With Userform Command Button
    By omagoodness in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2015, 11:18 AM
  2. [SOLVED] Populate Userform text box with command button in worksheet
    By STU22 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-19-2014, 11:32 PM
  3. Enterkng data on a specific worksheet using a userform command button
    By fbiasi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-29-2014, 11:41 AM
  4. create new workbook from userform command button
    By simeonmein in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2013, 04:36 AM
  5. Using a worksheet command button to start userform initialize procedures
    By paulary30 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-21-2012, 12:25 PM
  6. Command button code to write to worksheet and then open userform
    By Reidm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-18-2008, 10:33 AM
  7. Specifying a Command Button on a worksheet as differentiated from one on a UserForm
    By Amber_D_Laws in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-07-2006, 11:43 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