Hello
I have this situation:
If Not Intersect(target, Range("E11:G11")) Is Nothing Then
Run "Launch"
End If
-lunch is a user form and on this form i have a listbox1 and a cmdOkay
-on the listbox1 i have all the values from sheet2 in these 3 ranges: Range("D2" & LRowd); Range("F2:F" & LRowf) and Range("G2:G" & LRowg)
-I want that when i select Range("E11") only the cells from cld to show up on the listbox1, NOT all of them, so i think i need a SELECT CASE for these ranges, but I DONT KNOW HOW TO PUT IT, so..
CAN ANYONE PLEASE HELP ME??? THANKS!
I have this situation:
If Not Intersect(target, Range("E11:G11")) Is Nothing Then
Run "Launch"
End If
-lunch is a user form and on this form i have a listbox1 and a cmdOkay
Code:
[COLOR=#333333]
Private Sub UserForm_Initialize()
[/COLOR][COLOR=#333333]Dim cld, clf, clg As Range[/COLOR]
[COLOR=#333333]Dim cl As Range[/COLOR]
[COLOR=#333333]LRowd = Worksheets("nota_db_omn").Cells(Rows.Count, "D").End(xlUp).Row[/COLOR]
[COLOR=#333333]LRowf = Worksheets("nota_db_omn").Cells(Rows.Count, "F").End(xlUp).Row[/COLOR]
[COLOR=#333333]LRowg = Worksheets("nota_db_omn").Cells(Rows.Count, "G").End(xlUp).Row[/COLOR]
[COLOR=#333333]'Load the combobox with a variety of household pets[/COLOR]
[COLOR=#333333]With Me.ListBox1[/COLOR]
[COLOR=#333333]'Clear the rowsource in case it has been set[/COLOR]
[COLOR=#333333].RowSource = ""[/COLOR]
[COLOR=#333333]'Dim rng1 As Range[/COLOR]
[COLOR=#333333]'Set rng1 = Sheets("nota_db_omn").Range("D2:D3")[/COLOR]
[COLOR=#333333]'ActiveWorkbook.Names.Add Name:="reglementari", RefersTo:=rng1[/COLOR]
[COLOR=#333333]'Add the items from Cell A10 to the last used row in column A[/COLOR]
[COLOR=#333333]Select Case cl[/COLOR]
[COLOR=#333333]Case cld[/COLOR]
[COLOR=#333333]For Each cld In Worksheets("nota_db_omn").Range("D2:D" & LRowd)[/COLOR]
[COLOR=#333333]'For Each cl In Worksheets("Sheet1").rng1[/COLOR]
[COLOR=#333333].AddItem cld.Value[/COLOR]
[COLOR=#333333]Next cld[/COLOR]
[COLOR=#333333]End Select[/COLOR]
[COLOR=#333333]For Each clf In Worksheets("nota_db_omn").Range("F2:F" & LRowf)[/COLOR]
[COLOR=#333333]'For Each cl In Worksheets("Sheet1").rng1[/COLOR]
[COLOR=#333333].AddItem clf.Value[/COLOR]
[COLOR=#333333]Next clf[/COLOR]
[COLOR=#333333]For Each clg In Worksheets("nota_db_omn").Range("G2:G" & LRowg)[/COLOR]
[COLOR=#333333]'For Each cl In Worksheets("Sheet1").rng1[/COLOR]
[COLOR=#333333].AddItem clg.Value[/COLOR]
[COLOR=#333333]Next clg[/COLOR]
[COLOR=#333333]End With[/COLOR]
-on the listbox1 i have all the values from sheet2 in these 3 ranges: Range("D2" & LRowd); Range("F2:F" & LRowf) and Range("G2:G" & LRowg)
-I want that when i select Range("E11") only the cells from cld to show up on the listbox1, NOT all of them, so i think i need a SELECT CASE for these ranges, but I DONT KNOW HOW TO PUT IT, so..
CAN ANYONE PLEASE HELP ME??? THANKS!
Last edited by a moderator: