C
Corey
I want to enable once the Combobox is left, that the value that was chosen from the worksheet, to change to a strikethrough font.
I am not sure how to code this, AND if it should go in the combobox section below or in the Commandbutton (OK) click on the userform,
What would i code and where to put it?
Private Sub ComboBox6_Exit(ByVal Cancel As MSForms.ReturnBoolean)
End Sub
OR
Private Sub CommandButton1_Click()
Sheets("DespatchData").Select
' does the stuff here
Unload Me
Sheets("Main").Select
Range("A1").Activate
End Sub
Code i use to populate Combobox6:
Private Sub ComboBox6_DropButtonClick()
Application.ScreenUpdating = False
If ComboBox6.ListCount > 0 Then Exit Sub
'Place the References in here for the Roll Numbers and Lengths
Dim lastcell As Long
Dim myrow As Long
lastcell = workSheets("InspectionData").Cells(Rows.Count, "A").End(xlUp).Row
With ActiveWorkbook.workSheets("InspectionData")
For myrow = 2 To lastcell
If .Cells(myrow, 1) <> "" Then
If .Cells(myrow, 1).Offset(-1, 2).Text = ComboBox28.Text And .Cells(myrow, 1).Offset(-1, 6).Text = ComboBox1.Text And .Cells(myrow, 1).Offset(0, 0).Value = ComboBox5.Text And IsNumeric(Trim(Mid(.Cells(myrow, 1), 2))) = True Then
For i = 2 To 22
If Cells(myrow, 3).Offset(i, 0).Font.Strikethrough = False And Cells(myrow, 3).Offset(i, 0).Value <> "" Then
ComboBox6.AddItem Cells(myrow, 3).Offset(i, 0)
Cells(myrow, 3).Offset(i, 0).Font.Strikethrough = True
End If
Next i
End If
End If
Next
End With
Application.ScreenUpdating = True
End Sub
I am not sure how to code this, AND if it should go in the combobox section below or in the Commandbutton (OK) click on the userform,
What would i code and where to put it?
Private Sub ComboBox6_Exit(ByVal Cancel As MSForms.ReturnBoolean)
End Sub
OR
Private Sub CommandButton1_Click()
Sheets("DespatchData").Select
' does the stuff here
Unload Me
Sheets("Main").Select
Range("A1").Activate
End Sub
Code i use to populate Combobox6:
Private Sub ComboBox6_DropButtonClick()
Application.ScreenUpdating = False
If ComboBox6.ListCount > 0 Then Exit Sub
'Place the References in here for the Roll Numbers and Lengths
Dim lastcell As Long
Dim myrow As Long
lastcell = workSheets("InspectionData").Cells(Rows.Count, "A").End(xlUp).Row
With ActiveWorkbook.workSheets("InspectionData")
For myrow = 2 To lastcell
If .Cells(myrow, 1) <> "" Then
If .Cells(myrow, 1).Offset(-1, 2).Text = ComboBox28.Text And .Cells(myrow, 1).Offset(-1, 6).Text = ComboBox1.Text And .Cells(myrow, 1).Offset(0, 0).Value = ComboBox5.Text And IsNumeric(Trim(Mid(.Cells(myrow, 1), 2))) = True Then
For i = 2 To 22
If Cells(myrow, 3).Offset(i, 0).Font.Strikethrough = False And Cells(myrow, 3).Offset(i, 0).Value <> "" Then
ComboBox6.AddItem Cells(myrow, 3).Offset(i, 0)
Cells(myrow, 3).Offset(i, 0).Font.Strikethrough = True
End If
Next i
End If
End If
Next
End With
Application.ScreenUpdating = True
End Sub