C
Corey
I currently have combobox1 populated with values from sheet1.Range(R2:R12)
Combobox2 is populated with ALL Numerical values in sheet1.Range(A:A).
But i want ONLY Combobox2 populated with ALL Numerical values that have
..offset(-1,2).value = combobox1.value
The code to popultate combobox2 currently is:
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
With ActiveWorkbook.workSheets1
..Select
For myrow = 2 To lastcell
If .Cells(myrow, 1) <> "" Then
If IsNumeric(Trim(Mid(.Cells(myrow, 1), 2))) = True Then
ComboBox2.AddItem Cells(myrow, 1)
End If
End If
Next
End With
End Sub
Need something like:
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
If combobox2.value offset(-1, 2).value <> combobox1.value then REMOVE from
Combobox2.list ' <========= This bit here
With ActiveWorkbook.workSheets1
..Select
For myrow = 2 To lastcell
If .Cells(myrow, 1) <> "" Then
If IsNumeric(Trim(Mid(.Cells(myrow, 1), 2))) = True Then
ComboBox2.AddItem Cells(myrow, 1)
End If
End If
Next
End With
End Sub
Have been assisted with some other code to find the cell and it may be
needed to fix the above:
Dim rngFound As Range
On Error Resume Next
With workSheets2.Range("C:C")
Set rngFound = .Find(what:=Me.ComboBox1.Value, after:=.Range("C1"),
LookIn:=xlValues, lookat:=xlPart, searchorder:=xlByRows,
searchdirection:=xlNext, MatchCase:=False, matchbyte:=False)
' Top Section Values
Tough one for me to work out.
Corey....
Combobox2 is populated with ALL Numerical values in sheet1.Range(A:A).
But i want ONLY Combobox2 populated with ALL Numerical values that have
..offset(-1,2).value = combobox1.value
The code to popultate combobox2 currently is:
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
With ActiveWorkbook.workSheets1
..Select
For myrow = 2 To lastcell
If .Cells(myrow, 1) <> "" Then
If IsNumeric(Trim(Mid(.Cells(myrow, 1), 2))) = True Then
ComboBox2.AddItem Cells(myrow, 1)
End If
End If
Next
End With
End Sub
Need something like:
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
If combobox2.value offset(-1, 2).value <> combobox1.value then REMOVE from
Combobox2.list ' <========= This bit here
With ActiveWorkbook.workSheets1
..Select
For myrow = 2 To lastcell
If .Cells(myrow, 1) <> "" Then
If IsNumeric(Trim(Mid(.Cells(myrow, 1), 2))) = True Then
ComboBox2.AddItem Cells(myrow, 1)
End If
End If
Next
End With
End Sub
Have been assisted with some other code to find the cell and it may be
needed to fix the above:
Dim rngFound As Range
On Error Resume Next
With workSheets2.Range("C:C")
Set rngFound = .Find(what:=Me.ComboBox1.Value, after:=.Range("C1"),
LookIn:=xlValues, lookat:=xlPart, searchorder:=xlByRows,
searchdirection:=xlNext, MatchCase:=False, matchbyte:=False)
' Top Section Values
Tough one for me to work out.
Corey....