PDA

View Full Version : Stranger problem



Nader
02-29-2008, 10:54 AM
Have you faced like this problem before
I used both of these code to do same thing and I found smae problem
the problem is when I copy the items form sheet1 to material sheet and then delete the item in material sheet manually ( selected by mouse and use delete key) and try to release the code again. It copy the item in a new rwos, but if I use the code :
Cells.Clear to delete the items, they copy them in previous rows. They work very well.




Here is the file

Simon Lloyd
03-01-2008, 05:34 AM
You probably have the code in the worksheet_change event!

Nader
03-01-2008, 07:02 AM
I had this code in the userform1. When I deleted it, my code works very well but I need to this code, so I tried to change the sheets(3) to Sheets("Save") and it works very well, but up to now I couldn't understand the problem. bY the way I have a lot of this code in the same event of userform1.


Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
For i = 0 To Sheets("Save").Cells(1, 1).Value
If Sheets("Save").Cells(1, 1).Value = "" Then Exit Sub
lstM.AddItem Sheets("Save").Cells(i + 2, 1).Value
Next i

End Sub