+ Reply to Thread
Results 1 to 19 of 19

Editing Existing Data in a column using a userform.

  1. #1
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Editing Existing Data in a column using a userform.

    Hi everyone.

    once again, i need help.

    Can you help me with my problem,

    in my excel program, i have a userform that will input orders in column.

    And i've anticipate human errors, so i will create another userform for editing.

    How can i retrieve existing data from my worksheet to my userform for editing. Searching the PO number.

    Screenshot 2014-07-16 02.17.jpg

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Editing Existing Data in a column using a userform.

    are you able to apply a code to jpg file ?
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Re: Editing Existing Data in a column using a userform.

    Example.xlsm

    my bad. i forgot to upload the file. my apology

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Editing Existing Data in a column using a userform.

    Hi, chubbyjenz,

    maybe try the workbook attached. I donīt think you should really start considering a Textbox to retrieve PO Numbers.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    You will have to play a bit with the form to understand how it works.

    Ciao,
    Holger
    Attached Files Attached Files
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  5. #5
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Re: Editing Existing Data in a column using a userform.

    wooow... thank you for this one.. i like it much.

    can i ask off topic? how can i do it if i want to add a new entry and will automatically be inserted on a column (arrange according to PO number)
    say my last entry was 2853 and i want to add PO number 2852, and data will be inserted before column 2853

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Editing Existing Data in a column using a userform.

    Hi, chubbyjenz,

    instead of getting the new column number like now you would have to compare the PO number to the one in the last Column and then decide to add after that or run a loop back until the number fits in (you would have to insert a Column there to add the data which would be a different code as you would need to do that prior to writing the data). I would consider to add like before and maybe sort the range according to the numbers.

    Ciao,
    Holger

  7. #7
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Re: Editing Existing Data in a column using a userform.

    i'll deal with that one later.

    i'm having a hard time with your code right now. i'm sorry, i'm just new to vba programming. hehe

    could you please run me through the codes you used? i'll be using this for my next excel vba. if it's not too much of course.

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Editing Existing Data in a column using a userform.

    Hi, chubbyjenz,

    if it's not too much of course.
    At this time of the day (itīs 21:20 local time) and after nearly 15 hours Iīd say I could do it by tomorrow but at least give you some hints on how to do it on your own.

    Once you open the workbook the UserForm is displayed. Use Cancel there to unload the Form. Switrch into the VBE, go to the code behind the UserForm.

    Place the cursor in the first executable line of code of UserForm_Initialize and press F9. Normally a dark brown point should appear next to that line indicationg a Breakpoint. Thios point will stop the execution of the point (thatīs wanted) but will disappear if you close the workbook (tahtsīs wanted too).

    Same with the breakpoint goes for
    - Submitbtn_click
    - cmdImport_Click
    - ComboBox1_Change.

    Like stated any execution will be stopped and bring you to the line in the VBE. You may continue to single-step through the code by using F8 where you may watch the values of the variables as well as the effect to the worksheet if you have a look at that part besides the VBE.

    HTH,
    Holger

  9. #9
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Re: Editing Existing Data in a column using a userform.

    yeah, i've printed the codes and i'm trying to analyze it right now.

    in my understanding, you've replaced the cells by variable lngRC am i right or not?

    i'm just anticipating my next vba excel worksheet. because in my next worksheet. it will somehow look like that but, the userform will input on

    cells 5-9 ; 11-15 ; 17-21 ; 23-27 and so one. (one blank cell after 5 cells) how will i do that?

  10. #10
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Editing Existing Data in a column using a userform.

    Hi, chubbyjenz,

    in my understanding, you've replaced the cells by variable lngRC am i right or not?
    Absolutley right. I was using a loop and used the loop counter instead of hard-coding teh row numbers.

    cells 5-9 ; 11-15 ; 17-21 ; 23-27 and so one. (one blank cell after 5 cells) how will i do that?
    I really donīt like working with the loop counter. There are at least two general ways to handle this. One is to use a loop counter for the whole area of rows (from 5 to 27) and use a Select Case and just run the code in Case of 5 to 9, 11 to 15 etc. while skipping the other numbers. The second one is to use another counter running from 1 to 5 being augmented by 1 at the start of the loop. When he reaches 5 he augments the main counter by one (thatīs what I hate about it) and is set back to 0 for the next loop. But isnīt that worth a thread if the new project is in work?

    Ciao,
    Holger

  11. #11
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Re: Editing Existing Data in a column using a userform.

    ill just study this one before creating a new thread. or simply have my data input from 5- infinity with no augmentation.

    can you tell me what is this one?
    Controls("tb" & Format(lngRC-4, "0")).Value = .cells(lngRC,lngCC)

    how does that works?

  12. #12
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Editing Existing Data in a column using a userform.

    Hi, chubbyjenz,

    as this is part of the loop I donīt know a different way to address multiple Textboxes all being named accordingly.

    The command checks the names of the controls on the UserForm and applies the action to those that meet the criteria. All of your Textboxes for the loop start with tb and feature a 2-digit number with leading zero.
    The first Textbox is names tb01 and should match Row 5 in the worksheet. As the row counter is looping from 5 to 24 we need to substract 4 from the row counter in order to get the proper Textbox to work with. The Format-command gets in the leading 0 for the numbers between 1 and 9.

    HTH,
    Holger

  13. #13
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Re: Editing Existing Data in a column using a userform.

    hi hahobe,

    is there another way for that import thing but based on my hard coding code?

  14. #14
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Editing Existing Data in a column using a userform.

    Hi, chubbyjenz,

    sorry but I canīt get the point of what you are asking in the last post - you would have to explain again (at least for me).

    Ciao,
    Holger

  15. #15
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Re: Editing Existing Data in a column using a userform.

    you remember that the file that i uploaded?

    is there another easier way that you can insert the import code to my existing code?

  16. #16
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Editing Existing Data in a column using a userform.

    Hi, chubbyjenz,

    if I had been able to imagine a way to incorporate most of your code and build up on that I would have done so. If the code supplied by me isnīt working like expected Iīd be willing to work on that but Iīm afraid I will not start over and develop another solution just because you are asking for it. Maybe some other member may come in with a different approach or according to what you wish.

    Ciao,
    Holger

  17. #17
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Re: Editing Existing Data in a column using a userform.

    hi hahobe.

    i've followed your code to my new excel project. however, everytime i click submit, my combobox list gets double.

    it gets

    None
    92312
    1232
    2321
    231
    None
    92312
    1232
    2321
    231

  18. #18
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Editing Existing Data in a column using a userform.

    Hi, chubbyjenz,

    from what I understannd from my code the ComboBox will get cleared every time the UserForm ia activated or the command being called thus preventing multiple entries to be made:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Ciao,
    Holger

  19. #19
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Re: Editing Existing Data in a column using a userform.

    hi Hahobe

    Thanks again.. thread solve.

+ 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. Userform>Editing a column temporarily in a sheet for textbox search
    By JustLukas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-12-2013, 02:18 AM
  2. Loading and Editing Data from Userform
    By Gazmon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-30-2013, 07:49 PM
  3. Editing & replacing worksheet data using VB userform
    By Beam_me_up in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-09-2012, 06:22 PM
  4. Editing Data Through A Userform
    By WoodsyMP5K in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-28-2012, 02:30 AM
  5. editing existing macro to add new column
    By dnmahendra in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-07-2010, 05:00 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