Hello,
I have used some code from the net to create a dynamic data range for selection from the combo box. It all works well except one column. The column title displays in the first combo-box but the range does not display in the second? It is called the exact same way as all the rest and i have checked the Name Manage and it refers to the correct location and range. I have checked font, spelling and anything else that i could think of but have not found a solution.
Here's the code,
The title that shows is Locks but the range below will not display? Every other title and range display without fault?
Any help will be much appreciated.
I have used some code from the net to create a dynamic data range for selection from the combo box. It all works well except one column. The column title displays in the first combo-box but the range does not display in the second? It is called the exact same way as all the rest and i have checked the Name Manage and it refers to the correct location and range. I have checked font, spelling and anything else that i could think of but have not found a solution.
Here's the code,
The title that shows is Locks but the range below will not display? Every other title and range display without fault?
Any help will be much appreciated.
HTML:
Private Sub ComboBox1_Change()
Me.ComboBox2 = ""
Select Case Me.ComboBox1
Case "Carpenter_Joiner"
Me.ComboBox2.RowSource = "Carpenter_Joiner"
Case "Concreting"
Me.ComboBox2.RowSource = "Concreting"
Case "General_Flooring"
Me.ComboBox2.RowSource = "General_Flooring"
Case "General_Labour_Costs"
Me.ComboBox2.RowSource = "General_Labour_Costs"
Case "Gyprock_Plastering"
Me.ComboBox2.RowSource = "Gyprock_Plastering"
Case "Irrigation"
Me.ComboBox2.RowSource = "Irrigation"
Case "Locks"
Me.ComboBox2.RowSource = "Locks"
Case "Mowing"
Me.ComboBox2.RowSource = "Mowing"
Case "Tiling"
Me.ComboBox2.RowSource = "Tiling"
Case "Travel_and_Overhead"
Me.ComboBox2.RowSource = "Travel_and_Overhead"
Case "Window_Cleaning"
Me.ComboBox2.RowSource = "Window_Cleaning"
Case "Painting"
Me.ComboBox2.RowSource = "Painting"
End Select
End Sub
Private Sub CommandButton1_Click()
End Sub
Private Sub UserForm_Initialize()
Dim lastrow As Long
Dim lastcolumn As Long
lastcolumn = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
With Worksheets("sheet1")
For I = 1 To lastcolumn
With .Columns(I)
lastrow = Sheet1.Cells(Rows.Count, I).End(xlUp).Row
'With Range(Cells(1, I), Cells(lastrow, I))
'Range(Cells(1, I), Cells(lastrow, I)).Select
'Selection.CreateNames Top:=True
'End With
Range(Cells(1, I), Cells(lastrow, I)).CreateNames Top:=True
End With
Next I
End With
Me.ComboBox1.RowSource = "Trades"
End Sub