multiple updates to database
'this snippet of code should work. What it does is it goes down your list of
cows and when it finds a cow # that is in your cowlist() array, it then
populates the next empty cell, either column c, d,e,f or g. HTH
Range("CowList").Select
X = ActiveCell.Row
Do While True
If Cells(X, 1).Value = Empty Then Exit Do 'if there is no cow # in col
A, then you're done.
For Y = 1 To NbrVaccined
If Cells(X, 2).Value = CowList(Y, 1) Then
If Cells(X, 3).Value = Empty Then
Cells(X, 3).Value = TheDate
Exit For
ElseIf Cells(X, 4).Value = Empty Then
Cells(X, 4).Value = TheDate
Exit For
ElseIf Cells(X, 5).Value = Empty Then
Cells(X, 5).Value = TheDate
Exit For
ElseIf Cells(X, 6).Value = Empty Then
Cells(X, 6).Value = TheDate
Exit For
ElseIf Cells(X, 7).Value = Empty Then
Cells(X, 7).Value = TheDate
Exit For
End If
End If
Next
X = X + 1
Loop
|