+ Reply to Thread
Results 1 to 4 of 4

Input data in next row/ linking combo box in user form.

Hybrid View

  1. #1
    Registered User
    Join Date
    07-23-2010
    Location
    southampton uk
    MS-Off Ver
    Excel 2007 , Excel 2011 Mac
    Posts
    22

    Input data in next row/ linking combo box in user form.

    Hi I am a complete beginner at vba and macros etc but I have had a good go and have got as far as i can without resorting to coming here for help!
    I have a user form with 9 text input boxes and 2 combo-boxes. The problem i have is that i have inputted to code to allow data to be put into columns (a,b,e,g,h,i,j,k,n) when save button is clicked. i want the save button to input data into the next row down and so on and not going over the same row as it is now.
    The other problem I have is that I want to have the two combo box's on the user form to input data into the combo box's I have in columns (c,d).
    Hopes this makes sense
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Input data in next row/ linking combo box in user form.

    hi, option
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-23-2010
    Location
    southampton uk
    MS-Off Ver
    Excel 2007 , Excel 2011 Mac
    Posts
    22

    Re: Input data in next row/ linking combo box in user form.

    Hi Watersev thank you so much , is there anyone who could explain how the code works?

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Input data in next row/ linking combo box in user form.

    Private Sub CMD_SAVE_Click()
    
    'define array of  1 row and 14 columns (number of columns in the data table)
    Dim data(1 To 14), lrow As Long
    
    'fill array with data from textboxes and comboboxes
    data(1) = memno_txt.Text
    data(2) = Fname_txt.Text
    data(3) = Memtype_combo.Value
    data(4) = Duration_combo.Value
    data(5) = Sdate_txt.Text
    data(7) = Address_txt.Text
    data(8) = telhome_txt.Text
    data(9) = telmob_txt.Text
    data(10) = emergancytel_txt.Text
    data(11) = email_txt.Text
    data(14) = Notes_txt
    
    'findlastrow
    lrow = Sheets("Sheet1").UsedRange.Rows.Count + 1
    
    'output to the sheet
    Sheets("Sheet1").Cells(lrow, 1).Resize(, 14) = data
    
    End Sub
    
    Private Sub UserForm_Initialize()
    'create array from the string using split and coma as delimiter and assign to combobox
    Memtype_combo.List = Split("Standard Direct Debit,Standard Cash Pay,Hythe Dragons Direct Debit,Hythe Dragons Cash Pay", ",")
    Duration_combo.List = Split("week,1,3,6,12", ",")
    End Sub

+ 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