Problem with number 1

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
 
D

Dave D-C

Without actually (me) doing anything,
I might suggest doing
debug.print c.address, [other stuff?] and
debug.print d.address, [other stuff?]
to get a handle on what's going on.
 
P

Paul Tikken

Dave,

Doesn't do any good, something else I forgot to mention is that instead of
swopping the number 1 it actually select and changes the number 10 instead of
1. Very strange, I've got no clue! You?

Cheers,

Paul

Dave D-C said:
Without actually (me) doing anything,
I might suggest doing
debug.print c.address, [other stuff?] and
debug.print d.address, [other stuff?]
to get a handle on what's going on.

Paul Tikken said:
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 [snip]
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top