nigelandrewfoster
Well-known Member
- Joined
- May 27, 2009
- Messages
- 747
Hi,
The following code stores the values in a userform, containing several list boxes and text boxes:
The row source for .Ranging_List is a three cell column, containing "All", "Prog" and "Trad". The default highlighted value is "All". When I run the macro, .Ranging_List.Value returns "".
Its ListIndex is 0, so it should return "All". The two neighbouring list boxes are returning their default (and highlighted) values, so why not this one? Any ideas? Very puzzling.
Thanks for reading.
Nigel
The following code stores the values in a userform, containing several list boxes and text boxes:
Code:
Sub Write_Item() Dim ItemRow As Integer, r As Range, Typ
Typ = Array("Ambient", "Fresh", "Kit", "Literature", "Non-Consumables")
With IngredientRecord_Form
ItemRow = ItemRowOs(.ItemName_Txt.Value)
If ItemRow >= 1 Then
Set r = Worksheets("Items").[a1].Offset(ItemRow)
Else
Set r = Worksheets("Items").[b2]
Do While r <> ""
Set r = r.Offset(1)
Loop
Set r = r.Offset(, -1)
End If
r.Value = .ItemType_List.Value
r.Offset(, 1).Value = .ItemName_Txt.Value
r.Offset(, 2).Value = .ItemCode_Txt.Value
r.Offset(, 3).Value = .AMPM_List.Value
r.Offset(, 4).Value = .Supplier_List.Value
[SIZE=2][I][B] r.Offset(, 5).Value = .Ranging_List.Value[/B][/I][/SIZE]
r.Offset(, 6).Value = .Incost_Txt.Value
r.Offset(, 7).Value = .UnitCase_Txt.Value
r.Offset(, 8).Value = .SampleUnit_Txt.Value
r.Offset(, 9).Value = .SampleCase_Txt.Value
r.Offset(, 10).Value = .SampleType_Txt.Value
r.Offset(, 11).Value = .ProdCode_Txt.Value
r.Offset(, 13).Value = .TimeDist_Txt.Value
.ItemName_Txt.SetFocus
End With
End Sub
The row source for .Ranging_List is a three cell column, containing "All", "Prog" and "Trad". The default highlighted value is "All". When I run the macro, .Ranging_List.Value returns "".
Its ListIndex is 0, so it should return "All". The two neighbouring list boxes are returning their default (and highlighted) values, so why not this one? Any ideas? Very puzzling.
Thanks for reading.
Nigel
Last edited: