If anyone can help, I'd appreciate it! I have a userform which includes a listbox, a number of optionbuttons, a combobox and 20 checkboxes. The idea is to select a checkbox and then to place a number of variables against it in a 6 column list. On clicking ADD the data is displayed in the listbox. Then by clicking anther checkbox, you go through the whole shebang again and load the list with another set of values. I have succssfully catered for the option box logic but what's defying me is loading by each checkbox. Once this is sorted I need to be able to pass the data to another element be it an array or structure. Can anyone help. Here's my code so far:-
Dim DistArray(5, 3)
Private Sub Dp_Cmd_Add_Click()
Dim i As Single
Dim Dist1 As Integer
Dim Prot1 As String
Dim Com1 As String
Dim Pole As String
Dp_Lst_Rating.MultiSelect = fmMultiSelectMulti
MySettings.Dp_Cmb_Rating = Dp_Cmb_Rating
If Dp_Chk_Ow1 = True Then Dist1 = 1
If Dp_Opt_Fuse = True Then Prot1 = "Fuse" Else If Dp_Opt_Fuse = False Then Prot1 = "CB"
If Dp_Opt_Fuse = True Then Dp_Opt_Trip.Enabled = False And Dp_Opt_Ind.Enabled = False
If Dp_Opt_Fuse = True Then Dp_Opt_SPole.Enabled = False And Dp_Opt_DPole.Enabled = False
If Dp_Opt_Trip = True Then Com1 = "Trip" Else If Dp_Opt_Fuse = False Then Com1 = "Ind"
If Dp_Opt_SPole = True Then Pole = "Single" Else If Dp_Opt_SPole = False Then Pole = "Double"
Dp_Lst_Rating.ColumnCount = 5
DistArray(0, 0) = "Cct Number"
DistArray(1, 0) = "Rating"
DistArray(2, 0) = "Fuse/CB"
DistArray(3, 0) = "Trip/Ind"
DistArray(4, 0) = "Pole"
DistArray(0, 1) = Dist1
DistArray(1, 1) = MySettings.Dp_Cmb_Rating
DistArray(2, 1) = Prot1
DistArray(3, 1) = Com1
DistArray(4, 1) = Pole
DistArray(5, 1) = ""
DistArray(0, 2) = Dist1
DistArray(1, 2) = ""
DistArray(2, 2) = Prot1
DistArray(3, 2) = ""
DistArray(4, 2) = ""
DistArray(5, 2) = ""
Dp_Lst_Rating.Column() = DistArray
End Sub
Private Sub Dp_Cmd_Cancel_Click()
Unload frmDistribution_Parameters
End Sub
Private Sub Dp_Cmd_Ok_Click()
MySettings.Dp_Opt_Fuse = Dp_Opt_Fuse
MySettings.Dp_Opt_Cb = Dp_Opt_Cb
MySettings.Dp_Opt_Trip = Dp_Opt_Trip
MySettings.Dp_Opt_Ind = Dp_Opt_Ind
MySettings.Dp_Cmb_Rating = Dp_Cmb_Rating
MySettings.Dp_Chk_Ow1 = Dp_Chk_Ow1
MySettings.Dp_Chk_Ow2 = Dp_Chk_Ow2
MySettings.Dp_Opt_SPole = Dp_Opt_SPole
MySettings.Dp_Opt_DPole = Dp_Opt_DPole
Sheet1.Select
Unload frmDistribution_Parameters
End Sub
Private Sub Dp_Cmd_Clear_Click()
Unload frmDistribution_Parameters
frmDistribution_Parameters.Show
End Sub
Private Sub Dp_Cmd_Rem_Click()
Dp_Lst_Rating.RemoveItem (Dp_Lst_Rating.ListIndex)
End Sub
Private Sub Dp_Opt_Fuse_Click()
Dp_Opt_Cb.Enabled = False
Dp_Opt_Trip.Enabled = False
Dp_Opt_Ind.Enabled = False
Dp_Opt_SPole.Enabled = False
Dp_Opt_DPole.Enabled = False
End Sub
Private Sub UserForm_Initialize()
Dp_Cmb_Rating.RowSource = "DP_RATING"
Dp_Opt_Fuse.TripleState = True
Dp_Opt_Cb.TripleState = True
Dp_Opt_Trip.TripleState = True
Dp_Opt_Ind.TripleState = True
End Sub
DaveFish
Dim DistArray(5, 3)
Private Sub Dp_Cmd_Add_Click()
Dim i As Single
Dim Dist1 As Integer
Dim Prot1 As String
Dim Com1 As String
Dim Pole As String
Dp_Lst_Rating.MultiSelect = fmMultiSelectMulti
MySettings.Dp_Cmb_Rating = Dp_Cmb_Rating
If Dp_Chk_Ow1 = True Then Dist1 = 1
If Dp_Opt_Fuse = True Then Prot1 = "Fuse" Else If Dp_Opt_Fuse = False Then Prot1 = "CB"
If Dp_Opt_Fuse = True Then Dp_Opt_Trip.Enabled = False And Dp_Opt_Ind.Enabled = False
If Dp_Opt_Fuse = True Then Dp_Opt_SPole.Enabled = False And Dp_Opt_DPole.Enabled = False
If Dp_Opt_Trip = True Then Com1 = "Trip" Else If Dp_Opt_Fuse = False Then Com1 = "Ind"
If Dp_Opt_SPole = True Then Pole = "Single" Else If Dp_Opt_SPole = False Then Pole = "Double"
Dp_Lst_Rating.ColumnCount = 5
DistArray(0, 0) = "Cct Number"
DistArray(1, 0) = "Rating"
DistArray(2, 0) = "Fuse/CB"
DistArray(3, 0) = "Trip/Ind"
DistArray(4, 0) = "Pole"
DistArray(0, 1) = Dist1
DistArray(1, 1) = MySettings.Dp_Cmb_Rating
DistArray(2, 1) = Prot1
DistArray(3, 1) = Com1
DistArray(4, 1) = Pole
DistArray(5, 1) = ""
DistArray(0, 2) = Dist1
DistArray(1, 2) = ""
DistArray(2, 2) = Prot1
DistArray(3, 2) = ""
DistArray(4, 2) = ""
DistArray(5, 2) = ""
Dp_Lst_Rating.Column() = DistArray
End Sub
Private Sub Dp_Cmd_Cancel_Click()
Unload frmDistribution_Parameters
End Sub
Private Sub Dp_Cmd_Ok_Click()
MySettings.Dp_Opt_Fuse = Dp_Opt_Fuse
MySettings.Dp_Opt_Cb = Dp_Opt_Cb
MySettings.Dp_Opt_Trip = Dp_Opt_Trip
MySettings.Dp_Opt_Ind = Dp_Opt_Ind
MySettings.Dp_Cmb_Rating = Dp_Cmb_Rating
MySettings.Dp_Chk_Ow1 = Dp_Chk_Ow1
MySettings.Dp_Chk_Ow2 = Dp_Chk_Ow2
MySettings.Dp_Opt_SPole = Dp_Opt_SPole
MySettings.Dp_Opt_DPole = Dp_Opt_DPole
Sheet1.Select
Unload frmDistribution_Parameters
End Sub
Private Sub Dp_Cmd_Clear_Click()
Unload frmDistribution_Parameters
frmDistribution_Parameters.Show
End Sub
Private Sub Dp_Cmd_Rem_Click()
Dp_Lst_Rating.RemoveItem (Dp_Lst_Rating.ListIndex)
End Sub
Private Sub Dp_Opt_Fuse_Click()
Dp_Opt_Cb.Enabled = False
Dp_Opt_Trip.Enabled = False
Dp_Opt_Ind.Enabled = False
Dp_Opt_SPole.Enabled = False
Dp_Opt_DPole.Enabled = False
End Sub
Private Sub UserForm_Initialize()
Dp_Cmb_Rating.RowSource = "DP_RATING"
Dp_Opt_Fuse.TripleState = True
Dp_Opt_Cb.TripleState = True
Dp_Opt_Trip.TripleState = True
Dp_Opt_Ind.TripleState = True
End Sub
DaveFish