Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Range for combobox with IF

I have a user form with a combobox. I don't know much about writing code,
but i would like the ref list (range) to prettymuch be col B starting at row
7 - however i don't want everything in that col. I just want everything with
a number, no blanks or text.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Range for combobox with IF

This has not been tested, but should be OK. If not, post back with any error
messages received. Open the VB editor, right click on the userform name and
click view code in the pop up menu. Paste the code below into the code
window for the form. When you use the UserForm1.Show in the standard code
module1, it should load your combo box.

Private Sub UserForm_Initialize()
Dim lr As Long, i As Long
lr = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
With ActiveSheet
For i = 7 To lr
If .Cells(i, 2) < "" And IsNumeric(.Cells(i, 2)) Then
Me.ComboBox1.AddItem .Cells(i, 2)
End If
Next
End With
End Sub




"KUMPFfrog" wrote:

I have a user form with a combobox. I don't know much about writing code,
but i would like the ref list (range) to prettymuch be col B starting at row
7 - however i don't want everything in that col. I just want everything with
a number, no blanks or text.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Range for combobox with IF

Great!!! Thanks so much
Now how do I make this numeric list show as assending?

"JLGWhiz" wrote:

This has not been tested, but should be OK. If not, post back with any error
messages received. Open the VB editor, right click on the userform name and
click view code in the pop up menu. Paste the code below into the code
window for the form. When you use the UserForm1.Show in the standard code
module1, it should load your combo box.

Private Sub UserForm_Initialize()
Dim lr As Long, i As Long
lr = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
With ActiveSheet
For i = 7 To lr
If .Cells(i, 2) < "" And IsNumeric(.Cells(i, 2)) Then
Me.ComboBox1.AddItem .Cells(i, 2)
End If
Next
End With
End Sub




"KUMPFfrog" wrote:

I have a user form with a combobox. I don't know much about writing code,
but i would like the ref list (range) to prettymuch be col B starting at row
7 - however i don't want everything in that col. I just want everything with
a number, no blanks or text.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Range for combobox with IF

See if this site can help you with that:

http://support.microsoft.com/kb/227178





"KUMPFfrog" wrote:

Great!!! Thanks so much
Now how do I make this numeric list show as assending?

"JLGWhiz" wrote:

This has not been tested, but should be OK. If not, post back with any error
messages received. Open the VB editor, right click on the userform name and
click view code in the pop up menu. Paste the code below into the code
window for the form. When you use the UserForm1.Show in the standard code
module1, it should load your combo box.

Private Sub UserForm_Initialize()
Dim lr As Long, i As Long
lr = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
With ActiveSheet
For i = 7 To lr
If .Cells(i, 2) < "" And IsNumeric(.Cells(i, 2)) Then
Me.ComboBox1.AddItem .Cells(i, 2)
End If
Next
End With
End Sub




"KUMPFfrog" wrote:

I have a user form with a combobox. I don't know much about writing code,
but i would like the ref list (range) to prettymuch be col B starting at row
7 - however i don't want everything in that col. I just want everything with
a number, no blanks or text.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Range for combobox with IF

JLGWhiz
i was hoping you could help me again. this time i want to populate a
combobox based on this criteria:
column "n" only if coresponding value in column "s" matches textbox.value

"JLGWhiz" wrote:

This has not been tested, but should be OK. If not, post back with any error
messages received. Open the VB editor, right click on the userform name and
click view code in the pop up menu. Paste the code below into the code
window for the form. When you use the UserForm1.Show in the standard code
module1, it should load your combo box.

Private Sub UserForm_Initialize()
Dim lr As Long, i As Long
lr = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
With ActiveSheet
For i = 7 To lr
If .Cells(i, 2) < "" And IsNumeric(.Cells(i, 2)) Then
Me.ComboBox1.AddItem .Cells(i, 2)
End If
Next
End With
End Sub




"KUMPFfrog" wrote:

I have a user form with a combobox. I don't know much about writing code,
but i would like the ref list (range) to prettymuch be col B starting at row
7 - however i don't want everything in that col. I just want everything with
a number, no blanks or text.



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
combobox value < range Shawn Excel Programming 5 June 1st 07 10:37 PM
ComboBox Range ca1358 Excel Programming 2 January 9th 06 08:48 PM
Combobox to range Kjeldc Excel Programming 5 August 26th 05 09:57 PM
Show one range in a combobox and write the 2nd range! Kevin Excel Programming 1 October 17th 03 05:52 AM
ComboBox.Value To Range Hamilton R. Romano Excel Programming 0 September 9th 03 05:28 PM


All times are GMT +1. The time now is 04:53 PM.

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

About Us

"It's about Microsoft Excel"