+ Reply to Thread
Results 1 to 3 of 3

pre-populating combox text fields

  1. #1
    Registered User
    Join Date
    10-08-2011
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    4

    pre-populating combox text fields

    Hi, I'm a bit of a newbie to VBA and would like to reach out to other's expertise to help me with the following.

    I have an Excel 2013 workbook containing 5 worksheets.

    I am trying to use a clickable button on sheet 1 that opens a combobox to allow the user to edit a row of data in sheet 2.

    (Sheet 1 already contains other buttons that successfully allow the user to input data and inserts that data into sheet 2 at the next empty row)

    I want the new combobox to allow the user to select, via the first dropdown box, a serial number from Sheet 2 column 1 (I have achieved this successfully via the rowsource named range reference.

    I need the other text boxes in the combo box to pre-populate with the corresponding row values relative to the serial number selected so that the user can quickly make edit changes to the data rather than re-type everything.

    I hope that makes sense.

    I thought the code below may sort it but have had no success yet. Thanks in advance.

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 04-15-2017 at 10:47 AM. Reason: Added missing CODE tags. Please read and follow the Forum Rules we all abide, link above in the menu bar. Thanks.

  2. #2
    Forum Contributor
    Join Date
    10-19-2012
    Location
    Omaha, Nebraska USA
    MS-Off Ver
    Excel 2010
    Posts
    249

    Re: pre-populating combox text fields

    Hi Backstop,

    I have attached a workbook that may provide some assistance. If you hit the "Edit Data" button, a userform will pop up that has a combobox with the list of data in column A and then as items are picked within that combobox, it updates the corresponding text boxes for Columns B through D.

    Hope that helps,

    Dan
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-08-2011
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: pre-populating combox text fields

    Hi Dan,

    Thank you so much, after a bit of re-jigging I managed to get that to work and my Userform now populates with the correct row of data according to my serial number. However,

    I also have a routine via a save button within the same userform that previously wrote the contents of the userform text fields to the worksheet. The layout of the userform allows the user to enter a different serial number into a new text box (so as to not disrupt the serialnumber search and populate box) I am looking for the existing text boxes that have been pre-populated to be over written/edited and re-written to the corresponding row. All that happens when I run the full userform routine is the Combobox fields are correctly pre-populated but only the blank 'New' serial number text box is correctly written and none of the other pre-filled and edited boxes are written to the sheet.

    Here is the Save routine code. Any further help greatly appreciated.

    (

    Private Sub Save_Click()
    Dim strPassword As String
    strPassword = "**********"
    Sheets("Stock In").Unprotect strPassword
    On Error GoTo NotFound

    Sheets("Stock In").Select

    With ActiveSheet

    Set ValueFound = .Cells.Find(Me.SerialNumber)
    ValueFound.Offset(, 0) = Me.EditSerialnumber:
    ValueFound.Offset(, 1) = Me.EditDate
    ValueFound.Offset(, 2) = Me.EditMake
    ValueFound.Offset(, 3) = Me.EditModel

    End With

    NotFound:

    Sheets("Stock In").Protect strPassword
    Sheets("Home").Select
    Application.ScreenUpdating = True

    End Sub

    )

+ 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. issue populating combox options from vba
    By gdallas in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-15-2015, 06:56 AM
  2. Update Combox with Slicer items - getting error on Combox.listcount
    By Bigkx06 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2014, 02:47 PM
  3. [SOLVED] Populating Combobox with another combox in same userform
    By DataVanMan in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 11-12-2012, 04:16 PM
  4. populating fields with 1 or .5
    By gth667h in forum Excel General
    Replies: 0
    Last Post: 09-29-2010, 01:51 PM
  5. Combox Box : Populating values dynamically
    By Yuvarani in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-03-2010, 12:54 AM
  6. Combox & Text Box copy data to cell
    By Leej84 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2010, 03:19 PM
  7. Auto populating fields
    By Mark in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-15-2005, 04:05 PM

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