Hi,
Below is a pic of the SOR Validation userform for explanation.
Code is below that.
I am breaking the issue into small parts.
I would like help with the following. Lets say, as is the case in this picture, a user has selected Carpenter_Joiner in first dropdown then CABM03 in the second. This the displays the data from the excel file to the right from columns C, D and E in the text box.
What I want to do is set one of the command buttons to copy the row, which would be row 7 in this example, ending at column F. So it would copy row 7 data only from column A to F. The copied data will then be pasted to a yet to be defined location, but it will be part of a worksheet. That part forms part of the larger project and I only want to tackle bite sized bits with each post. I will post a new question once this part is solved.
Thank you in advance for any help.
Regards,
Wayne
Below is a pic of the SOR Validation userform for explanation.
Code is below that.
I am breaking the issue into small parts.
I would like help with the following. Lets say, as is the case in this picture, a user has selected Carpenter_Joiner in first dropdown then CABM03 in the second. This the displays the data from the excel file to the right from columns C, D and E in the text box.
What I want to do is set one of the command buttons to copy the row, which would be row 7 in this example, ending at column F. So it would copy row 7 data only from column A to F. The copied data will then be pasted to a yet to be defined location, but it will be part of a worksheet. That part forms part of the larger project and I only want to tackle bite sized bits with each post. I will post a new question once this part is solved.
Thank you in advance for any help.
Regards,
Wayne
VBA Code:
Private Sub workbook_open()
GMSORs.Show
End Sub
'Private Sub UserForm_Initialize()
' Me.ComboBox1.RowSource = ""
' Me.ComboBox2.RowSource = ""
' Me.TextBox1.MultiLine = True
' Me.TextBox1.BackColor = "&H80000004"
'This code pulls the trade names
' With Sheets("GMSOR's")
' Me.ComboBox1.Value = ActiveCell.Offset(0, -1).Value
' Me.ComboBox2.Value = ActiveCell.Value
' ActiveCell.Offset(0, 1).Select
' End With
'End Sub
Private Sub UserForm_Initialize()
Me.ComboBox1.RowSource = ""
Me.ComboBox2.RowSource = ""
Me.TextBox1.MultiLine = True
Me.TextBox1.BackColor = "&H80000004"
'This code pulls the trade names
With Sheets("GMSOR's")
Me.ComboBox1.List = .Range("K2", .Cells(.Rows.Count, "K").End(xlUp)).Value
ActiveCell.Offset(0, 1).Select
End With
End Sub
Private Sub ComboBox2_Enter()
Dim vList, i As Long
With Sheets("GMSOR's")
vList = .Range("A1:B" & .Cells(.Rows.Count, "A").End(xlUp).Row)
End With
Me.ComboBox2.Clear
For i = LBound(vList) To UBound(vList)
If UCase(vList(i, 1)) = UCase(Me.ComboBox1.Value) Then Me.ComboBox2.AddItem vList(i, 2)
Next
End Sub
Private Sub ComboBox1_Change()
Me.ComboBox2.Clear
End Sub
Private Sub ComboBox2_Change()
Dim c As Range
Dim fm
TextBox1 = ""
With Sheets("GMSOR's")
fm = Application.Match(Me.ComboBox2, .Range("B1", .Cells(.Rows.Count, "B").End(xlUp)), 0)
If IsNumeric(fm) Then
For Each c In .Range("C" & fm & ":E" & fm)
tx = tx & " - " & c
Next
TextBox1 = Right(tx, Len(tx) - 3)
End If
End With
End Sub
Private Sub TextBox1_Enter()
Me.ComboBox2.SetFocus
End Sub