I don't have much VBA experience at all, but this is what I'm trying to do (code is below):
I have two sheets- one of dies, one of sales. Each sale has a die it comes from, with a many sales to one die relationship. I'd like to loop through all dies, and within that loop loop through all sales, and compare each of the rows to a set of criteria before outputting them.
'All dies have a type and a size. All products have a type and a size. We hope to match them.
Sub searchroute()
Dim x As Integer, y As Integer, z As Integer
x = 0 'for row offset on dies, number
y = 0 'for row offset on sales, item
z = 0 'for later use
Do Until IsEmpty(Worksheets("Dies").a2.Offset(x, 0)) = True
Do Until IsEmpty(Worksheets("Sales").a2.Offset(y, 0)) = True
If Worksheets("Dies").i2.Offset(x, 0) = Worksheets("Sales").c2.Offset(y, 0) Or Worksheets("Dies").i2.Offset(x, 0) = "Any" Then
If Worksheets("Sales").g2.Offset(y, 0) = Worksheets("Dies").j2.Offset(x, 0) Or Worksheets("Dies").j2.Offset(x, 0) = "Any" Then
'then we've got the same type and size, print output to a cell
'should figure out how to append, place the whole list in a single cell
End If
End If
y = y + 1
Loop
x = x + 1
Loop
End Sub
Stepping through this, it pops a 438 error on the first Do Until. I know this is something easy, but my mind is blank.
Thanks in advance for wisdom!
Do Until IsEmpty(Worksheets("Dies").range("A2").Offset(x, 0)) = TrueOr something along he lines of that. Your issue stems from a lack of a range object I think.