instanceoftime
Board Regular
- Joined
- Mar 23, 2011
- Messages
- 102
I would like to find the first complete "row" in the array that didn't contain blanks (A-H) and paste that info to the end of the spreadsheet.
Code:
Private Sub cmdEnter_Click()
Dim str1 As String, str2 As String, str3 As String, str4 As String, str5 As String, str6 As String, str7 As String, str8 As String
Dim NotFound As Integer
Dim I As Long
NotFound = 0
ActiveWorkbook.Sheets("Items").Activate
With ActiveSheet
arr = .Range("A1:H" & .Cells(.Rows.Count, "A").End(xlUp).Row)
End With
For I = 1 To UBound(arr)
If arr(I, 1) = ItemNumber Then 'multiple AND statements here?????
str1 = IIf(str1 = "", arr(I, 1), str1 & "|" & arr(I, 1)) 'item number
str2 = IIf(str2 = "", arr(I, 2), str2 & "|" & arr(I, 2)) 'description
str3 = IIf(str3 = "", arr(I, 3), str3 & "|" & arr(I, 3)) 'id
str4 = IIf(str4 = "", arr(I, 4), str4 & "|" & arr(I, 4)) 'date
str5 = IIf(str5 = "", arr(I, 5), str5 & "|" & arr(I, 5)) 'dept#
str6 = IIf(str6 = "", arr(I, 6), str6 & "|" & arr(I, 6)) 'dept
str7 = IIf(str7 = "", arr(I, 7), str7 & "|" & arr(I, 7)) 'upc
str8 = IIf(str8 = "", arr(I, 8), str8 & "|" & arr(I, 8)) 'price
End If
Next
End Sub