none
HELP! Combine two comboboxes with three textboxes and return the text of the boxes to a specific fields on worksheet RRS feed

  • Question

  • Hello, i'm trying to finish a school VBA project,but i'm stucked in a function.

    I want to select two diferent options coming from combobox, then using that criteria write in three diferent textbox the transfer that data to diferent fields of the worksheet.

    Please send me ideas because i'm pretty much desperate right now...

    Image VBA1 - the userform with the 2 combo and 3 textbox

    [IMG]http://i62.tinypic.com/1zf7c6w.jpg[/IMG]

    Image VBA2 - thwworkseet with diferent fields to fill with 3 previous textbox

    [IMG]http://i58.tinypic.com/aw7sqv.jpg[/IMG]

     
    • Edited by Nunompo Friday, September 12, 2014 7:55 PM
    Friday, September 12, 2014 7:20 PM

Answers

  • Just set the Controlsource property of the text boxes and combobox:

    ex: Sheetname!A5

    This will sync the changes in the control values with the worksheet cell values.

    • Proposed as answer by Syswizard Friday, September 12, 2014 10:21 PM
    • Marked as answer by George HuaModerator Monday, September 22, 2014 2:16 AM
    Friday, September 12, 2014 7:44 PM
  • Hi

    With a button on your Userform, this will copy on the first empty row, starting in column A.

    Private Sub cmbAdd_Click()
    Dim c As Range
    Application.ScreenUpdating = False
    Worksheets("Database").Select
        Set c = Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
        c.Value = Me.TextBox1.Value
        c.Offset(0, 1).Value = Me.TextBox2.Value
        c.Offset(0, 2).Value = Me.TextBox3.Value

    Application.ScreenUpdating = True

    End sub

    If that helps, please vote as helpful and if that answer your question then mark it Answered.


    Cimjet

    • Proposed as answer by Cimjet Saturday, September 13, 2014 12:59 AM
    • Marked as answer by George HuaModerator Monday, September 22, 2014 2:16 AM
    Saturday, September 13, 2014 12:58 AM

All replies

  • Just set the Controlsource property of the text boxes and combobox:

    ex: Sheetname!A5

    This will sync the changes in the control values with the worksheet cell values.

    • Proposed as answer by Syswizard Friday, September 12, 2014 10:21 PM
    • Marked as answer by George HuaModerator Monday, September 22, 2014 2:16 AM
    Friday, September 12, 2014 7:44 PM
  • Hi

    With a button on your Userform, this will copy on the first empty row, starting in column A.

    Private Sub cmbAdd_Click()
    Dim c As Range
    Application.ScreenUpdating = False
    Worksheets("Database").Select
        Set c = Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
        c.Value = Me.TextBox1.Value
        c.Offset(0, 1).Value = Me.TextBox2.Value
        c.Offset(0, 2).Value = Me.TextBox3.Value

    Application.ScreenUpdating = True

    End sub

    If that helps, please vote as helpful and if that answer your question then mark it Answered.


    Cimjet

    • Proposed as answer by Cimjet Saturday, September 13, 2014 12:59 AM
    • Marked as answer by George HuaModerator Monday, September 22, 2014 2:16 AM
    Saturday, September 13, 2014 12:58 AM