Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Don Don is offline
external usenet poster
 
Posts: 487
Default "Which control to use in a UserForm?"

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default "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


  #3   Report Post  
Posted to microsoft.public.excel.programming
Don Don is offline
external usenet poster
 
Posts: 487
Default "Which control to use in a UserForm?"

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

"Bob Phillips" wrote:


"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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to have a macro simply issue the "find" command or "control f: Charles Adams Excel Programming 3 February 6th 09 06:34 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
"Control" plus "click" doesn't allow me to select multiple cells Ken Cooke New Users to Excel 0 September 25th 06 04:46 PM
Scroll Bar missing "Control" tab in "Format Properties" dialog box Peter Rooney Excel Discussion (Misc queries) 5 August 24th 06 05:36 PM
Error "Permission denied" when printing Web Browser control from button on userform, Charles Jordan Excel Programming 0 July 8th 04 04:19 PM


All times are GMT +1. The time now is 09:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"