"Which control to use in a UserForm?"
"Don" wrote in message
...
This is my first shot at this task so be patient, please...:)
I would like to develop a UserForm2 that can be called from an option
button
on another UserForm1. UF1 is already done and works fine.
On UF2 would be either a ComboBox or a ListBox, or whatever might be
appropriate to get the following job done. I have a list of names on
Sheet1
in ColA. This list would be loaded into the ?box so that the OP could
scroll
to and highlight a name for an action.
Combobox sounds right
Then code assigned to an "OK" button would do the following:
Determine the Row the name is in, Select that entire Row and ClearContents
(not Delete) of same. Delete introduces errors on other Sheets in the WB.
iRow = Application.Match(ComboBox1.Value,
Worksheets("Sheet1").Columns(1),0)
If iRow 0 Then
Rows(i).ClearContents
End If
I'm also having a bit of trouble loading Col A into a ListBox or ComboBox.
(this has to be done everytime UF2 is called as the list does change from
time to time) If it matters, I already have a macro that will be called
that
sorts Sheet1 using Col A for the sort so there are no empty Rows in Col A,
prior to calling UF2.
With Worksheets("Sheet1").
iLastRow = .Cells(.Rows.Count,"A").End(xlUp).Row
For i = 1 To iLastRow
CombobBox1.AddItem .Cells(i,"A").Value
Next i
End With
|