P
Paul Tikken
Hi,
I've got a userform with several listboxes;
I'm using the code below to transfer selected values in listbox3 to
listbox6, but at the same time these values are being swopped and deleted in
worksheets(4), so when I close the document and later re-open it the values
in listbox3 and 6 in the userform are the same as before I closed the
document. (Is there an other way to do this?) In the ranges mentioned in the
code equal the numbers 1 tru 4092, all the numbers are working fine, except
number 1 in cell A1. This number isn't swopped at all, anybody any ideas?
Thanks,
Paul
Private Sub ListBox3_DblClick(ByVal Cancel As MSForms.ReturnBoolean) 'Link
11 PU
With Worksheets(4).Range("A1:A4092")
Set c = .FIND(ListBox3.Value, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Cells.Offset(0, 4) = c.Value
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
With Worksheets(4).Range("C1:C4092")
Set d = .FIND(ListBox3.Value, LookIn:=xlValues)
If Not d Is Nothing Then
firstAddress = d.Address
Do
d.Cells.Clear
Loop While Not d Is Nothing And d.Address <> firstAddress
d.Cells.Delete
End If
End With
ActiveCell = ListBox3.Value
For Each Item In ActiveCell
TDL.ListBox6.AddItem Item
Next Item
With ListBox3
If .ListIndex >= 0 Then
.RemoveItem .ListIndex
.ListIndex = -1
End If
End With
Label3.Caption = "PU's: " & (ListBox3.ListCount)
Label6.Caption = "Allocated " & (ListBox6.ListCount)
ActiveCell.Offset(0, 1).Activate
End Sub
I've got a userform with several listboxes;
I'm using the code below to transfer selected values in listbox3 to
listbox6, but at the same time these values are being swopped and deleted in
worksheets(4), so when I close the document and later re-open it the values
in listbox3 and 6 in the userform are the same as before I closed the
document. (Is there an other way to do this?) In the ranges mentioned in the
code equal the numbers 1 tru 4092, all the numbers are working fine, except
number 1 in cell A1. This number isn't swopped at all, anybody any ideas?
Thanks,
Paul
Private Sub ListBox3_DblClick(ByVal Cancel As MSForms.ReturnBoolean) 'Link
11 PU
With Worksheets(4).Range("A1:A4092")
Set c = .FIND(ListBox3.Value, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Cells.Offset(0, 4) = c.Value
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
With Worksheets(4).Range("C1:C4092")
Set d = .FIND(ListBox3.Value, LookIn:=xlValues)
If Not d Is Nothing Then
firstAddress = d.Address
Do
d.Cells.Clear
Loop While Not d Is Nothing And d.Address <> firstAddress
d.Cells.Delete
End If
End With
ActiveCell = ListBox3.Value
For Each Item In ActiveCell
TDL.ListBox6.AddItem Item
Next Item
With ListBox3
If .ListIndex >= 0 Then
.RemoveItem .ListIndex
.ListIndex = -1
End If
End With
Label3.Caption = "PU's: " & (ListBox3.ListCount)
Label6.Caption = "Allocated " & (ListBox6.ListCount)
ActiveCell.Offset(0, 1).Activate
End Sub