NDayave
11-29-2008, 06:49 AM
How Do,
I have a rather simple user form that I want to save data on the worksheet. I want the column in a list to be compared to a list on the worksheet and if it matches add a "1" in the appropriate box.
So far I have
For x = 1 To 20
If lstCurrentOps.Column(0, x) = (Range("OptionsCost").Cells(x, 1)) Then
Range("OptionsCar" & lblFactory.Caption & "1").Cells(x) = "1"
Else
For y = 1 To 20
If lstCurrentOps.Column(0, x) = (Range("OptionsCost").Cells(y, 1)) Then
Range("OptionsCar" & lblFactory.Caption & "1").Cells(y) = "1"
End If
Next y
End If
Next x
Where lstCurrentOps has one column holding the Options chosen, OptionsCost being a named table with the Otions available and their respective cost and lblFactory a label holding which Factory the car is produced in, allowing the form to know what car to assign the options to (eg: OptionsCar23 for car 3 in factory 2).
I hit an error with the column property though, saying that it "could not get the column property. Invalid Property array index". It works fine with numbers (eg .column(0,1)) but not the variable reference (0,x).
Any help is much appreciated.
Cheers,
NDayave
I have a rather simple user form that I want to save data on the worksheet. I want the column in a list to be compared to a list on the worksheet and if it matches add a "1" in the appropriate box.
So far I have
For x = 1 To 20
If lstCurrentOps.Column(0, x) = (Range("OptionsCost").Cells(x, 1)) Then
Range("OptionsCar" & lblFactory.Caption & "1").Cells(x) = "1"
Else
For y = 1 To 20
If lstCurrentOps.Column(0, x) = (Range("OptionsCost").Cells(y, 1)) Then
Range("OptionsCar" & lblFactory.Caption & "1").Cells(y) = "1"
End If
Next y
End If
Next x
Where lstCurrentOps has one column holding the Options chosen, OptionsCost being a named table with the Otions available and their respective cost and lblFactory a label holding which Factory the car is produced in, allowing the form to know what car to assign the options to (eg: OptionsCar23 for car 3 in factory 2).
I hit an error with the column property though, saying that it "could not get the column property. Invalid Property array index". It works fine with numbers (eg .column(0,1)) but not the variable reference (0,x).
Any help is much appreciated.
Cheers,
NDayave