dimanche 28 juin 2015

Pick and place unit

I am trying to make a loop for a pick and place unit.

The pick and place unit is capable of reading 1 row untill 1 of the cells is empty. All of the information in these rows should be treated as products.

Lets say that cell A has 25 types of information (A1 - A25). I want 4 products sorted in boxes of six, ( Row B, C, D, E for example), so we fill in which types of information we want to have sorted. In my case everthing except figures.

This is what I've got now:

Private Sub cmdStart_Click()

Dim varIndex As Variant
Dim i As Integer

i = 0

Do
i = i + 1


Range("A" & i) = varIndex
For varIndex = A To Z
If varIndex = 0 Or 1 Or 2 Or 3 Or 4 Or 5 Or 6 Or 7 Or 8 Or 9 Then Exit For
Next varIndex


If varIndex = TXTproduct1.Text Then Range("B" & i) = varIndex


Loop Until varIndex = Empty


End Sub

If you copy this code, fill in a blank box called TXTproduct1.text and if you have the type of information in row A in one of the cells. It will delete it out of the row and stop the script.

What I want to do is to keep the script going and make the now empty cell fill itself with the next cell. So if I want to re-use the program it won't crash on an empty cell when there's still information left.

If someone could help me out a bit, that would be awesome.

Aucun commentaire:

Enregistrer un commentaire