I'm in need of some help! My goal is to create a price list, I have set values in columns A to E, my problem is that I have an extra cost to add should certain cells by added together. I cannot get this adder to be included, any help would be greatly appreciated.
Below is the code (with reductions) and attached is the table I'm using, I'm hoping it's self explanatory.
[VBA]
Dim a As Long
Dim b As Long
Dim c As Long
Dim d As Long
Dim e As Long
Dim i1 As Long
Dim i2 As Long
Dim i3 As Long
Dim i4 As Long
Dim i5 As Long
Dim counter As Long
counter = 1
a = Range("A1").End(xlDown).Row
b = Range("B1").End(xlDown).Row
c = Range("C1").End(xlDown).Row
d = Range("D1").End(xlDown).Row
e = Range("E1").End(xlDown).Row
For i1 = 2 To a
For i2 = 2 To b
For i3 = 2 To c
For i4 = 2 To d
For i5 = 2 To e
'Added cost for C10
If Cells(i2, 2) = Range("B3") And Cells(i3, 3) = Range("C10") + Range("R3") Then GoTo Nexti
'Added cost for C11
If Cells(i2, 2) = Range("B3") And Cells(i3, 3) = Range("C11") + Range("U3") Then GoTo Nexti
'Added cost for C12
If Cells(i2, 2) = Range("B3") And Cells(i3, 3) = Range("C12") + Range("X3") Then GoTo Nexti
Cells(counter, 10) = Cells(i1, 1) + Cells(i2, 2) + Cells(i3, 3) + Cells(i4, 4) + Cells(i5, 5)
counter = counter + 1
Nexti:
Next i5
Next i4
Next i3
Next i2
Next i1
End Sub
[/VBA]
I have removed the repeated lines for adding R4 + B4 all the way to R40 + B40 and so on for the others. The only way I know how is to repeat the same line of code for each adder changing to cells each time. If there is a way to tidy this up I'd very much like to know about it.