"Which control to use in a UserForm?"

D

Don

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. 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.

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.

Any help would be greatly appreciated.

TIA.... Don
 
B

Bob Phillips

Don said:
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
 
D

Don

Thanks for the very quick reply Bob....I'll see if I can make it work and
post later the results.....Tks again... Don
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top