Hello,
Thank you for your help in advance.
I have designed a small program within excel to list a set of strings and their company in a certain way.
The program works in the way i intend. Although it's through reams and reams of code. Which is fine until I need to amend the algorithm or add new parameters.
I need to breakdown the code using loops instead.
Lets use the word Box for where my data is stored. This is a relatively small set of data. Using cells V3:AE42 - So 40 strings listed in V column.
Each string in V has 9 accompanying 'parameters' in the other columns.
The user then selects one of the strings to start the list off, and by determination my program will array the best outcome along a paste section using cells AG3:AP42. So basically rearranging the list in a specific order according to the parameters in the other columns.
My code initially pastes the selected string (+9) to cell AG3, goes back to the box, finds the next string that is not the same as the pasted string, uses then lets say "AI4" to see if that matches, if it doesn't match it looks at the next line in the box. (There are more parameters, but let's just use AI's for a starter). This is fine, but then as it pastes to the next row the program now needs to look at row 4's data instead of row 3 to generate the next row and so on. Would be fairly simple but for every line, the next line needs to be a different line and not take the same line twice. Each line has its own sub leading from one to the other. Hence why my code is so long. It looks at the box 40 times 40 times, so the lines of IF statements dismissing each line increase on every run. Until the final line looks like this: (Call collect grabs all the range data for me)
Sorry if this looks a bit crazy. It works for what I want it to do, it's just not practical. Any help would be appreciated, even if it can reduce the IFS down a bit.#
Thanks
Thank you for your help in advance.
I have designed a small program within excel to list a set of strings and their company in a certain way.
The program works in the way i intend. Although it's through reams and reams of code. Which is fine until I need to amend the algorithm or add new parameters.
I need to breakdown the code using loops instead.
Lets use the word Box for where my data is stored. This is a relatively small set of data. Using cells V3:AE42 - So 40 strings listed in V column.
Each string in V has 9 accompanying 'parameters' in the other columns.
The user then selects one of the strings to start the list off, and by determination my program will array the best outcome along a paste section using cells AG3:AP42. So basically rearranging the list in a specific order according to the parameters in the other columns.
My code initially pastes the selected string (+9) to cell AG3, goes back to the box, finds the next string that is not the same as the pasted string, uses then lets say "AI4" to see if that matches, if it doesn't match it looks at the next line in the box. (There are more parameters, but let's just use AI's for a starter). This is fine, but then as it pastes to the next row the program now needs to look at row 4's data instead of row 3 to generate the next row and so on. Would be fairly simple but for every line, the next line needs to be a different line and not take the same line twice. Each line has its own sub leading from one to the other. Hence why my code is so long. It looks at the box 40 times 40 times, so the lines of IF statements dismissing each line increase on every run. Until the final line looks like this: (Call collect grabs all the range data for me)
VBA Code:
Sub track40_set()
Call collect
energymatch = Range("ap41").Value
matchingkey = Range("ai41").Value
matchingkey2 = Range("aj41").Value
matchingkey3 = Range("ak41").Value
matchingkey4 = Range("al41").Value
matchingkey5 = Range("am41").Value
If track <> trackname Then
If track <> trackname2 Then
If track <> trackname3 Then
If track <> trackname4 Then
If track <> trackname5 Then
If track <> trackname6 Then
If track <> trackname7 Then
If track <> trackname8 Then
If track <> trackname9 Then
If track <> trackname10 Then
If track <> trackname11 Then
If track <> trackname12 Then
If track <> trackname13 Then
If track <> trackname14 Then
If track <> trackname15 Then
If track <> trackname16 Then
If track <> trackname17 Then
If track <> trackname18 Then
If track <> trackname19 Then
If track <> trackname20 Then
If track <> trackname21 Then
If track <> trackname22 Then
If track <> trackname23 Then
If track <> trackname24 Then
If track <> trackname25 Then
If track <> trackname26 Then
If track <> trackname27 Then
If track <> trackname28 Then
If track <> trackname29 Then
If track <> trackname30 Then
If track <> trackname31 Then
If track <> trackname32 Then
If track <> trackname33 Then
If track <> trackname34 Then
If track <> trackname35 Then
If track <> trackname36 Then
If track <> trackname37 Then
If track <> trackname38 Then
If track <> trackname39 Then
If energymatch = E1 Or energymatch = E1 + 1 Or energymatch = E1 - 1 Then
If matchingkey = K1 Or matchingkey2 = K1 Or matchingkey3 = K1 Or matchingkey4 = K1 Or matchingkey5 = K1 Then
Range("v3:ae3").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track2 <> trackname Then
If track2 <> trackname2 Then
If track2 <> trackname3 Then
If track2 <> trackname4 Then
If track2 <> trackname5 Then
If track2 <> trackname6 Then
If track2 <> trackname7 Then
If track2 <> trackname8 Then
If track2 <> trackname9 Then
If track2 <> trackname10 Then
If track2 <> trackname11 Then
If track2 <> trackname12 Then
If track2 <> trackname13 Then
If track2 <> trackname14 Then
If track2 <> trackname15 Then
If track2 <> trackname16 Then
If track2 <> trackname17 Then
If track2 <> trackname18 Then
If track2 <> trackname19 Then
If track2 <> trackname20 Then
If track2 <> trackname21 Then
If track2 <> trackname22 Then
If track2 <> trackname23 Then
If track2 <> trackname24 Then
If track2 <> trackname25 Then
If track2 <> trackname26 Then
If track2 <> trackname27 Then
If track2 <> trackname28 Then
If track2 <> trackname29 Then
If track2 <> trackname30 Then
If track2 <> trackname31 Then
If track2 <> trackname32 Then
If track2 <> trackname33 Then
If track2 <> trackname34 Then
If track2 <> trackname35 Then
If track2 <> trackname36 Then
If track2 <> trackname37 Then
If track2 <> trackname38 Then
If track2 <> trackname39 Then
If energymatch = E2 Or energymatch = E2 + 1 Or energymatch = E2 - 1 Then
If matchingkey = K2 Or matchingkey2 = K2 Or matchingkey3 = K2 Or matchingkey4 = K2 Or matchingkey5 = K2 Then
Range("v4:ae4").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track3 <> trackname Then
If track3 <> trackname2 Then
If track3 <> trackname3 Then
If track3 <> trackname4 Then
If track3 <> trackname5 Then
If track3 <> trackname6 Then
If track3 <> trackname7 Then
If track3 <> trackname8 Then
If track3 <> trackname9 Then
If track3 <> trackname10 Then
If track3 <> trackname11 Then
If track3 <> trackname12 Then
If track3 <> trackname13 Then
If track3 <> trackname14 Then
If track3 <> trackname15 Then
If track3 <> trackname16 Then
If track3 <> trackname17 Then
If track3 <> trackname18 Then
If track3 <> trackname19 Then
If track3 <> trackname20 Then
If track3 <> trackname21 Then
If track3 <> trackname22 Then
If track3 <> trackname23 Then
If track3 <> trackname24 Then
If track3 <> trackname25 Then
If track3 <> trackname26 Then
If track3 <> trackname27 Then
If track3 <> trackname28 Then
If track3 <> trackname29 Then
If track3 <> trackname30 Then
If track3 <> trackname31 Then
If track3 <> trackname32 Then
If track3 <> trackname33 Then
If track3 <> trackname34 Then
If track3 <> trackname35 Then
If track3 <> trackname36 Then
If track3 <> trackname37 Then
If track3 <> trackname38 Then
If track3 <> trackname39 Then
If energymatch = E3 Or energymatch = E3 + 1 Or energymatch = E3 - 1 Then
If matchingkey = K3 Or matchingkey2 = K3 Or matchingkey3 = K3 Or matchingkey4 = K3 Or matchingkey5 = K3 Then
Range("v5:ae5").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track4 <> trackname Then
If track4 <> trackname2 Then
If track4 <> trackname3 Then
If track4 <> trackname4 Then
If track4 <> trackname5 Then
If track4 <> trackname6 Then
If track4 <> trackname7 Then
If track4 <> trackname8 Then
If track4 <> trackname9 Then
If track4 <> trackname10 Then
If track4 <> trackname11 Then
If track4 <> trackname12 Then
If track4 <> trackname13 Then
If track4 <> trackname14 Then
If track4 <> trackname15 Then
If track4 <> trackname16 Then
If track4 <> trackname17 Then
If track4 <> trackname18 Then
If track4 <> trackname19 Then
If track4 <> trackname20 Then
If track4 <> trackname21 Then
If track4 <> trackname22 Then
If track4 <> trackname23 Then
If track4 <> trackname24 Then
If track4 <> trackname25 Then
If track4 <> trackname26 Then
If track4 <> trackname27 Then
If track4 <> trackname28 Then
If track4 <> trackname29 Then
If track4 <> trackname30 Then
If track4 <> trackname31 Then
If track4 <> trackname32 Then
If track4 <> trackname33 Then
If track4 <> trackname34 Then
If track4 <> trackname35 Then
If track4 <> trackname36 Then
If track4 <> trackname37 Then
If track4 <> trackname38 Then
If track4 <> trackname39 Then
If energymatch = E4 Or energymatch = E4 + 1 Or energymatch = E4 - 1 Then
If matchingkey = K4 Or matchingkey2 = K4 Or matchingkey3 = K4 Or matchingkey4 = K4 Or matchingkey5 = K4 Then
Range("v6:ae6").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track5 <> trackname Then
If track5 <> trackname2 Then
If track5 <> trackname3 Then
If track5 <> trackname4 Then
If track5 <> trackname5 Then
If track5 <> trackname6 Then
If track5 <> trackname7 Then
If track5 <> trackname8 Then
If track5 <> trackname9 Then
If track5 <> trackname10 Then
If track5 <> trackname11 Then
If track5 <> trackname12 Then
If track5 <> trackname13 Then
If track5 <> trackname14 Then
If track5 <> trackname15 Then
If track5 <> trackname16 Then
If track5 <> trackname17 Then
If track5 <> trackname18 Then
If track5 <> trackname19 Then
If track5 <> trackname20 Then
If track5 <> trackname21 Then
If track5 <> trackname22 Then
If track5 <> trackname23 Then
If track5 <> trackname24 Then
If track5 <> trackname25 Then
If track5 <> trackname26 Then
If track5 <> trackname27 Then
If track5 <> trackname28 Then
If track5 <> trackname29 Then
If track5 <> trackname30 Then
If track5 <> trackname31 Then
If track5 <> trackname32 Then
If track5 <> trackname33 Then
If track5 <> trackname34 Then
If track5 <> trackname35 Then
If track5 <> trackname36 Then
If track5 <> trackname37 Then
If track5 <> trackname38 Then
If track5 <> trackname39 Then
If energymatch = E5 Or energymatch = E5 + 1 Or energymatch = E5 - 1 Then
If matchingkey = K5 Or matchingkey2 = K5 Or matchingkey3 = K5 Or matchingkey4 = K5 Or matchingkey5 = K5 Then
Range("v7:ae7").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track6 <> trackname Then
If track6 <> trackname2 Then
If track6 <> trackname3 Then
If track6 <> trackname4 Then
If track6 <> trackname5 Then
If track6 <> trackname6 Then
If track6 <> trackname7 Then
If track6 <> trackname8 Then
If track6 <> trackname9 Then
If track6 <> trackname10 Then
If track6 <> trackname11 Then
If track6 <> trackname12 Then
If track6 <> trackname13 Then
If track6 <> trackname14 Then
If track6 <> trackname15 Then
If track6 <> trackname16 Then
If track6 <> trackname17 Then
If track6 <> trackname18 Then
If track6 <> trackname19 Then
If track6 <> trackname20 Then
If track6 <> trackname21 Then
If track6 <> trackname22 Then
If track6 <> trackname23 Then
If track6 <> trackname24 Then
If track6 <> trackname25 Then
If track6 <> trackname26 Then
If track6 <> trackname27 Then
If track6 <> trackname28 Then
If track6 <> trackname29 Then
If track6 <> trackname30 Then
If track6 <> trackname31 Then
If track6 <> trackname32 Then
If track6 <> trackname33 Then
If track6 <> trackname34 Then
If track6 <> trackname35 Then
If track6 <> trackname36 Then
If track6 <> trackname37 Then
If track6 <> trackname38 Then
If track6 <> trackname39 Then
If energymatch = E6 Or energymatch = E6 + 1 Or energymatch = E6 - 1 Then
If matchingkey = K6 Or matchingkey2 = K6 Or matchingkey3 = K6 Or matchingkey4 = K6 Or matchingkey5 = K6 Then
Range("v8:ae8").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track7 <> trackname Then
If track7 <> trackname2 Then
If track7 <> trackname3 Then
If track7 <> trackname4 Then
If track7 <> trackname5 Then
If track7 <> trackname6 Then
If track7 <> trackname7 Then
If track7 <> trackname8 Then
If track7 <> trackname9 Then
If track7 <> trackname10 Then
If track7 <> trackname11 Then
If track7 <> trackname12 Then
If track7 <> trackname13 Then
If track7 <> trackname14 Then
If track7 <> trackname15 Then
If track7 <> trackname16 Then
If track7 <> trackname17 Then
If track7 <> trackname18 Then
If track7 <> trackname19 Then
If track7 <> trackname20 Then
If track7 <> trackname21 Then
If track7 <> trackname22 Then
If track7 <> trackname23 Then
If track7 <> trackname24 Then
If track7 <> trackname25 Then
If track7 <> trackname26 Then
If track7 <> trackname27 Then
If track7 <> trackname28 Then
If track7 <> trackname29 Then
If track7 <> trackname30 Then
If track7 <> trackname31 Then
If track7 <> trackname32 Then
If track7 <> trackname33 Then
If track7 <> trackname34 Then
If track7 <> trackname35 Then
If track7 <> trackname36 Then
If track7 <> trackname37 Then
If track7 <> trackname38 Then
If track7 <> trackname39 Then
If energymatch = E7 Or energymatch = E7 + 1 Or energymatch = E7 - 1 Then
If matchingkey = K7 Or matchingkey2 = K7 Or matchingkey3 = K7 Or matchingkey4 = K7 Or matchingkey5 = K7 Then
Range("v9:ae9").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track8 <> trackname Then
If track8 <> trackname2 Then
If track8 <> trackname3 Then
If track8 <> trackname4 Then
If track8 <> trackname5 Then
If track8 <> trackname6 Then
If track8 <> trackname7 Then
If track8 <> trackname8 Then
If track8 <> trackname9 Then
If track8 <> trackname10 Then
If track8 <> trackname11 Then
If track8 <> trackname12 Then
If track8 <> trackname13 Then
If track8 <> trackname14 Then
If track8 <> trackname15 Then
If track8 <> trackname16 Then
If track8 <> trackname17 Then
If track8 <> trackname18 Then
If track8 <> trackname19 Then
If track8 <> trackname20 Then
If track8 <> trackname21 Then
If track8 <> trackname22 Then
If track8 <> trackname23 Then
If track8 <> trackname24 Then
If track8 <> trackname25 Then
If track8 <> trackname26 Then
If track8 <> trackname27 Then
If track8 <> trackname28 Then
If track8 <> trackname29 Then
If track8 <> trackname30 Then
If track8 <> trackname31 Then
If track8 <> trackname32 Then
If track8 <> trackname33 Then
If track8 <> trackname34 Then
If track8 <> trackname35 Then
If track8 <> trackname36 Then
If track8 <> trackname37 Then
If track8 <> trackname38 Then
If track8 <> trackname39 Then
If energymatch = E8 Or energymatch = E8 + 1 Or energymatch = E8 - 1 Then
If matchingkey = K8 Or matchingkey2 = K8 Or matchingkey3 = K8 Or matchingkey4 = K8 Or matchingkey5 = K8 Then
Range("v10:ae10").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track9 <> trackname Then
If track9 <> trackname2 Then
If track9 <> trackname3 Then
If track9 <> trackname4 Then
If track9 <> trackname5 Then
If track9 <> trackname6 Then
If track9 <> trackname7 Then
If track9 <> trackname8 Then
If track9 <> trackname9 Then
If track9 <> trackname10 Then
If track9 <> trackname11 Then
If track9 <> trackname12 Then
If track9 <> trackname13 Then
If track9 <> trackname14 Then
If track9 <> trackname15 Then
If track9 <> trackname16 Then
If track9 <> trackname17 Then
If track9 <> trackname18 Then
If track9 <> trackname19 Then
If track9 <> trackname20 Then
If track9 <> trackname21 Then
If track9 <> trackname22 Then
If track9 <> trackname23 Then
If track9 <> trackname24 Then
If track9 <> trackname25 Then
If track9 <> trackname26 Then
If track9 <> trackname27 Then
If track9 <> trackname28 Then
If track9 <> trackname29 Then
If track9 <> trackname30 Then
If track9 <> trackname31 Then
If track9 <> trackname32 Then
If track9 <> trackname33 Then
If track9 <> trackname34 Then
If track9 <> trackname35 Then
If track9 <> trackname36 Then
If track9 <> trackname37 Then
If track9 <> trackname38 Then
If track9 <> trackname39 Then
If energymatch = E9 Or energymatch = E9 + 1 Or energymatch = E9 - 1 Then
If matchingkey = K9 Or matchingkey2 = K9 Or matchingkey3 = K9 Or matchingkey4 = K9 Or matchingkey5 = K9 Then
Range("v11:ae11").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track10 <> trackname Then
If track10 <> trackname2 Then
If track10 <> trackname3 Then
If track10 <> trackname4 Then
If track10 <> trackname5 Then
If track10 <> trackname6 Then
If track10 <> trackname7 Then
If track10 <> trackname8 Then
If track10 <> trackname9 Then
If track10 <> trackname10 Then
If track10 <> trackname11 Then
If track10 <> trackname12 Then
If track10 <> trackname13 Then
If track10 <> trackname14 Then
If track10 <> trackname15 Then
If track10 <> trackname16 Then
If track10 <> trackname17 Then
If track10 <> trackname18 Then
If track10 <> trackname19 Then
If track10 <> trackname20 Then
If track10 <> trackname21 Then
If track10 <> trackname22 Then
If track10 <> trackname23 Then
If track10 <> trackname24 Then
If track10 <> trackname25 Then
If track10 <> trackname26 Then
If track10 <> trackname27 Then
If track10 <> trackname28 Then
If track10 <> trackname29 Then
If track10 <> trackname30 Then
If track10 <> trackname31 Then
If track10 <> trackname32 Then
If track10 <> trackname33 Then
If track10 <> trackname34 Then
If track10 <> trackname35 Then
If track10 <> trackname36 Then
If track10 <> trackname37 Then
If track10 <> trackname38 Then
If track10 <> trackname39 Then
If energymatch = E10 Or energymatch = E10 + 1 Or energymatch = E10 - 1 Then
If matchingkey = K10 Or matchingkey2 = K10 Or matchingkey3 = K10 Or matchingkey4 = K10 Or matchingkey5 = K10 Then
Range("v12:ae12").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track11 <> trackname Then
If track11 <> trackname2 Then
If track11 <> trackname3 Then
If track11 <> trackname4 Then
If track11 <> trackname5 Then
If track11 <> trackname6 Then
If track11 <> trackname7 Then
If track11 <> trackname8 Then
If track11 <> trackname9 Then
If track11 <> trackname10 Then
If track11 <> trackname11 Then
If track11 <> trackname12 Then
If track11 <> trackname13 Then
If track11 <> trackname14 Then
If track11 <> trackname15 Then
If track11 <> trackname16 Then
If track11 <> trackname17 Then
If track11 <> trackname18 Then
If track11 <> trackname19 Then
If track11 <> trackname20 Then
If track11 <> trackname21 Then
If track11 <> trackname22 Then
If track11 <> trackname23 Then
If track11 <> trackname24 Then
If track11 <> trackname25 Then
If track11 <> trackname26 Then
If track11 <> trackname27 Then
If track11 <> trackname28 Then
If track11 <> trackname29 Then
If track11 <> trackname30 Then
If track11 <> trackname31 Then
If track11 <> trackname32 Then
If track11 <> trackname33 Then
If track11 <> trackname34 Then
If track11 <> trackname35 Then
If track11 <> trackname36 Then
If track11 <> trackname37 Then
If track11 <> trackname38 Then
If track11 <> trackname39 Then
If energymatch = E11 Or energymatch = E11 + 1 Or energymatch = E11 - 1 Then
If matchingkey = K11 Or matchingkey2 = K11 Or matchingkey3 = K11 Or matchingkey4 = K11 Or matchingkey5 = K11 Then
Range("v13:ae13").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track12 <> trackname Then
If track12 <> trackname2 Then
If track12 <> trackname3 Then
If track12 <> trackname4 Then
If track12 <> trackname5 Then
If track12 <> trackname6 Then
If track12 <> trackname7 Then
If track12 <> trackname8 Then
If track12 <> trackname9 Then
If track12 <> trackname10 Then
If track12 <> trackname11 Then
If track12 <> trackname12 Then
If track12 <> trackname13 Then
If track12 <> trackname14 Then
If track12 <> trackname15 Then
If track12 <> trackname16 Then
If track12 <> trackname17 Then
If track12 <> trackname18 Then
If track12 <> trackname19 Then
If track12 <> trackname20 Then
If track12 <> trackname21 Then
If track12 <> trackname22 Then
If track12 <> trackname23 Then
If track12 <> trackname24 Then
If track12 <> trackname25 Then
If track12 <> trackname26 Then
If track12 <> trackname27 Then
If track12 <> trackname28 Then
If track12 <> trackname29 Then
If track12 <> trackname30 Then
If track12 <> trackname31 Then
If track12 <> trackname32 Then
If track12 <> trackname33 Then
If track12 <> trackname34 Then
If track12 <> trackname35 Then
If track12 <> trackname36 Then
If track12 <> trackname37 Then
If track12 <> trackname38 Then
If track12 <> trackname39 Then
If energymatch = E12 Or energymatch = E12 + 1 Or energymatch = E12 - 1 Then
If matchingkey = K12 Or matchingkey2 = K12 Or matchingkey3 = K12 Or matchingkey4 = K12 Or matchingkey5 = K12 Then
Range("v14:ae14").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track13 <> trackname Then
If track13 <> trackname2 Then
If track13 <> trackname3 Then
If track13 <> trackname4 Then
If track13 <> trackname5 Then
If track13 <> trackname6 Then
If track13 <> trackname7 Then
If track13 <> trackname8 Then
If track13 <> trackname9 Then
If track13 <> trackname10 Then
If track13 <> trackname11 Then
If track13 <> trackname12 Then
If track13 <> trackname13 Then
If track13 <> trackname14 Then
If track13 <> trackname15 Then
If track13 <> trackname16 Then
If track13 <> trackname17 Then
If track13 <> trackname18 Then
If track13 <> trackname19 Then
If track13 <> trackname20 Then
If track13 <> trackname21 Then
If track13 <> trackname22 Then
If track13 <> trackname23 Then
If track13 <> trackname24 Then
If track13 <> trackname25 Then
If track13 <> trackname26 Then
If track13 <> trackname27 Then
If track13 <> trackname28 Then
If track13 <> trackname29 Then
If track13 <> trackname30 Then
If track13 <> trackname31 Then
If track13 <> trackname32 Then
If track13 <> trackname33 Then
If track13 <> trackname34 Then
If track13 <> trackname35 Then
If track13 <> trackname36 Then
If track13 <> trackname37 Then
If track13 <> trackname38 Then
If track13 <> trackname39 Then
If energymatch = E13 Or energymatch = E13 + 1 Or energymatch = E13 - 1 Then
If matchingkey = K13 Or matchingkey2 = K13 Or matchingkey3 = K13 Or matchingkey4 = K13 Or matchingkey5 = K13 Then
Range("v15:ae15").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track14 <> trackname Then
If track14 <> trackname2 Then
If track14 <> trackname3 Then
If track14 <> trackname4 Then
If track14 <> trackname5 Then
If track14 <> trackname6 Then
If track14 <> trackname7 Then
If track14 <> trackname8 Then
If track14 <> trackname9 Then
If track14 <> trackname10 Then
If track14 <> trackname11 Then
If track14 <> trackname12 Then
If track14 <> trackname13 Then
If track14 <> trackname14 Then
If track14 <> trackname15 Then
If track14 <> trackname16 Then
If track14 <> trackname17 Then
If track14 <> trackname18 Then
If track14 <> trackname19 Then
If track14 <> trackname20 Then
If track14 <> trackname21 Then
If track14 <> trackname22 Then
If track14 <> trackname23 Then
If track14 <> trackname24 Then
If track14 <> trackname25 Then
If track14 <> trackname26 Then
If track14 <> trackname27 Then
If track14 <> trackname28 Then
If track14 <> trackname29 Then
If track14 <> trackname30 Then
If track14 <> trackname31 Then
If track14 <> trackname32 Then
If track14 <> trackname33 Then
If track14 <> trackname34 Then
If track14 <> trackname35 Then
If track14 <> trackname36 Then
If track14 <> trackname37 Then
If track14 <> trackname38 Then
If track14 <> trackname39 Then
If energymatch = E14 Or energymatch = E14 + 1 Or energymatch = E14 - 1 Then
If matchingkey = K14 Or matchingkey2 = K14 Or matchingkey3 = K14 Or matchingkey4 = K14 Or matchingkey5 = K14 Then
Range("v16:ae16").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track15 <> trackname Then
If track15 <> trackname2 Then
If track15 <> trackname3 Then
If track15 <> trackname4 Then
If track15 <> trackname5 Then
If track15 <> trackname6 Then
If track15 <> trackname7 Then
If track15 <> trackname8 Then
If track15 <> trackname9 Then
If track15 <> trackname10 Then
If track15 <> trackname11 Then
If track15 <> trackname12 Then
If track15 <> trackname13 Then
If track15 <> trackname14 Then
If track15 <> trackname15 Then
If track15 <> trackname16 Then
If track15 <> trackname17 Then
If track15 <> trackname18 Then
If track15 <> trackname19 Then
If track15 <> trackname20 Then
If track15 <> trackname21 Then
If track15 <> trackname22 Then
If track15 <> trackname23 Then
If track15 <> trackname24 Then
If track15 <> trackname25 Then
If track15 <> trackname26 Then
If track15 <> trackname27 Then
If track15 <> trackname28 Then
If track15 <> trackname29 Then
If track15 <> trackname30 Then
If track15 <> trackname31 Then
If track15 <> trackname32 Then
If track15 <> trackname33 Then
If track15 <> trackname34 Then
If track15 <> trackname35 Then
If track15 <> trackname36 Then
If track15 <> trackname37 Then
If track15 <> trackname38 Then
If track15 <> trackname39 Then
If energymatch = E15 Or energymatch = E15 + 1 Or energymatch = E15 - 1 Then
If matchingkey = K15 Or matchingkey2 = K15 Or matchingkey3 = K15 Or matchingkey4 = K15 Or matchingkey5 = K15 Then
Range("v17:ae17").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track16 <> trackname Then
If track16 <> trackname2 Then
If track16 <> trackname3 Then
If track16 <> trackname4 Then
If track16 <> trackname5 Then
If track16 <> trackname6 Then
If track16 <> trackname7 Then
If track16 <> trackname8 Then
If track16 <> trackname9 Then
If track16 <> trackname10 Then
If track16 <> trackname11 Then
If track16 <> trackname12 Then
If track16 <> trackname13 Then
If track16 <> trackname14 Then
If track16 <> trackname15 Then
If track16 <> trackname16 Then
If track16 <> trackname17 Then
If track16 <> trackname18 Then
If track16 <> trackname19 Then
If track16 <> trackname20 Then
If track16 <> trackname21 Then
If track16 <> trackname22 Then
If track16 <> trackname23 Then
If track16 <> trackname24 Then
If track16 <> trackname25 Then
If track16 <> trackname26 Then
If track16 <> trackname27 Then
If track16 <> trackname28 Then
If track16 <> trackname29 Then
If track16 <> trackname30 Then
If track16 <> trackname31 Then
If track16 <> trackname32 Then
If track16 <> trackname33 Then
If track16 <> trackname34 Then
If track16 <> trackname35 Then
If track16 <> trackname36 Then
If track16 <> trackname37 Then
If track16 <> trackname38 Then
If track16 <> trackname39 Then
If energymatch = E16 Or energymatch = E16 + 1 Or energymatch = E16 - 1 Then
If matchingkey = K16 Or matchingkey2 = K16 Or matchingkey3 = K16 Or matchingkey4 = K16 Or matchingkey5 = K16 Then
Range("v18:ae18").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track17 <> trackname Then
If track17 <> trackname2 Then
If track17 <> trackname3 Then
If track17 <> trackname4 Then
If track17 <> trackname5 Then
If track17 <> trackname6 Then
If track17 <> trackname7 Then
If track17 <> trackname8 Then
If track17 <> trackname9 Then
If track17 <> trackname10 Then
If track17 <> trackname11 Then
If track17 <> trackname12 Then
If track17 <> trackname13 Then
If track17 <> trackname14 Then
If track17 <> trackname15 Then
If track17 <> trackname16 Then
If track17 <> trackname17 Then
If track17 <> trackname18 Then
If track17 <> trackname19 Then
If track17 <> trackname20 Then
If track17 <> trackname21 Then
If track17 <> trackname22 Then
If track17 <> trackname23 Then
If track17 <> trackname24 Then
If track17 <> trackname25 Then
If track17 <> trackname26 Then
If track17 <> trackname27 Then
If track17 <> trackname28 Then
If track17 <> trackname29 Then
If track17 <> trackname30 Then
If track17 <> trackname31 Then
If track17 <> trackname32 Then
If track17 <> trackname33 Then
If track17 <> trackname34 Then
If track17 <> trackname35 Then
If track17 <> trackname36 Then
If track17 <> trackname37 Then
If track17 <> trackname38 Then
If track17 <> trackname39 Then
If energymatch = E17 Or energymatch = E17 + 1 Or energymatch = E17 - 1 Then
If matchingkey = K17 Or matchingkey2 = K17 Or matchingkey3 = K17 Or matchingkey4 = K17 Or matchingkey5 = K17 Then
Range("v19:ae19").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track18 <> trackname Then
If track18 <> trackname2 Then
If track18 <> trackname3 Then
If track18 <> trackname4 Then
If track18 <> trackname5 Then
If track18 <> trackname6 Then
If track18 <> trackname7 Then
If track18 <> trackname8 Then
If track18 <> trackname9 Then
If track18 <> trackname10 Then
If track18 <> trackname11 Then
If track18 <> trackname12 Then
If track18 <> trackname13 Then
If track18 <> trackname14 Then
If track18 <> trackname15 Then
If track18 <> trackname16 Then
If track18 <> trackname17 Then
If track18 <> trackname18 Then
If track18 <> trackname19 Then
If track18 <> trackname20 Then
If track18 <> trackname21 Then
If track18 <> trackname22 Then
If track18 <> trackname23 Then
If track18 <> trackname24 Then
If track18 <> trackname25 Then
If track18 <> trackname26 Then
If track18 <> trackname27 Then
If track18 <> trackname28 Then
If track18 <> trackname29 Then
If track18 <> trackname30 Then
If track18 <> trackname31 Then
If track18 <> trackname32 Then
If track18 <> trackname33 Then
If track18 <> trackname34 Then
If track18 <> trackname35 Then
If track18 <> trackname36 Then
If track18 <> trackname37 Then
If track18 <> trackname38 Then
If track18 <> trackname39 Then
If energymatch = E18 Or energymatch = E18 + 1 Or energymatch = E18 - 1 Then
If matchingkey = K18 Or matchingkey2 = K18 Or matchingkey3 = K18 Or matchingkey4 = K18 Or matchingkey5 = K18 Then
Range("v20:ae20").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track19 <> trackname Then
If track19 <> trackname2 Then
If track19 <> trackname3 Then
If track19 <> trackname4 Then
If track19 <> trackname5 Then
If track19 <> trackname6 Then
If track19 <> trackname7 Then
If track19 <> trackname8 Then
If track19 <> trackname9 Then
If track19 <> trackname10 Then
If track19 <> trackname11 Then
If track19 <> trackname12 Then
If track19 <> trackname13 Then
If track19 <> trackname14 Then
If track19 <> trackname15 Then
If track19 <> trackname16 Then
If track19 <> trackname17 Then
If track19 <> trackname18 Then
If track19 <> trackname19 Then
If track19 <> trackname20 Then
If track19 <> trackname21 Then
If track19 <> trackname22 Then
If track19 <> trackname23 Then
If track19 <> trackname24 Then
If track19 <> trackname25 Then
If track19 <> trackname26 Then
If track19 <> trackname27 Then
If track19 <> trackname28 Then
If track19 <> trackname29 Then
If track19 <> trackname30 Then
If track19 <> trackname31 Then
If track19 <> trackname32 Then
If track19 <> trackname33 Then
If track19 <> trackname34 Then
If track19 <> trackname35 Then
If track19 <> trackname36 Then
If track19 <> trackname37 Then
If track19 <> trackname38 Then
If track19 <> trackname39 Then
If energymatch = E19 Or energymatch = E19 + 1 Or energymatch = E19 - 1 Then
If matchingkey = K19 Or matchingkey2 = K19 Or matchingkey3 = K19 Or matchingkey4 = K19 Or matchingkey5 = K19 Then
Range("v21:ae21").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track20 <> trackname Then
If track20 <> trackname2 Then
If track20 <> trackname3 Then
If track20 <> trackname4 Then
If track20 <> trackname5 Then
If track20 <> trackname6 Then
If track20 <> trackname7 Then
If track20 <> trackname8 Then
If track20 <> trackname9 Then
If track20 <> trackname10 Then
If track20 <> trackname11 Then
If track20 <> trackname12 Then
If track20 <> trackname13 Then
If track20 <> trackname14 Then
If track20 <> trackname15 Then
If track20 <> trackname16 Then
If track20 <> trackname17 Then
If track20 <> trackname18 Then
If track20 <> trackname19 Then
If track20 <> trackname20 Then
If track20 <> trackname21 Then
If track20 <> trackname22 Then
If track20 <> trackname23 Then
If track20 <> trackname24 Then
If track20 <> trackname25 Then
If track20 <> trackname26 Then
If track20 <> trackname27 Then
If track20 <> trackname28 Then
If track20 <> trackname29 Then
If track20 <> trackname30 Then
If track20 <> trackname31 Then
If track20 <> trackname32 Then
If track20 <> trackname33 Then
If track20 <> trackname34 Then
If track20 <> trackname35 Then
If track20 <> trackname36 Then
If track20 <> trackname37 Then
If track20 <> trackname38 Then
If track20 <> trackname39 Then
If energymatch = E20 Or energymatch = E20 + 1 Or energymatch = E20 - 1 Then
If matchingkey = K20 Or matchingkey2 = K20 Or matchingkey3 = K20 Or matchingkey4 = K20 Or matchingkey5 = K20 Then
Range("v22:ae22").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track21 <> trackname Then
If track21 <> trackname2 Then
If track21 <> trackname3 Then
If track21 <> trackname4 Then
If track21 <> trackname5 Then
If track21 <> trackname6 Then
If track21 <> trackname7 Then
If track21 <> trackname8 Then
If track21 <> trackname9 Then
If track21 <> trackname10 Then
If track21 <> trackname11 Then
If track21 <> trackname12 Then
If track21 <> trackname13 Then
If track21 <> trackname14 Then
If track21 <> trackname15 Then
If track21 <> trackname16 Then
If track21 <> trackname17 Then
If track21 <> trackname18 Then
If track21 <> trackname19 Then
If track21 <> trackname20 Then
If track21 <> trackname21 Then
If track21 <> trackname22 Then
If track21 <> trackname23 Then
If track21 <> trackname24 Then
If track21 <> trackname25 Then
If track21 <> trackname26 Then
If track21 <> trackname27 Then
If track21 <> trackname28 Then
If track21 <> trackname29 Then
If track21 <> trackname30 Then
If track21 <> trackname31 Then
If track21 <> trackname32 Then
If track21 <> trackname33 Then
If track21 <> trackname34 Then
If track21 <> trackname35 Then
If track21 <> trackname36 Then
If track21 <> trackname37 Then
If track21 <> trackname38 Then
If track21 <> trackname39 Then
If energymatch = E21 Or energymatch = E21 + 1 Or energymatch = E21 - 1 Then
If matchingkey = K21 Or matchingkey2 = K21 Or matchingkey3 = K21 Or matchingkey4 = K21 Or matchingkey5 = K21 Then
Range("v23:ae23").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track22 <> trackname Then
If track22 <> trackname2 Then
If track22 <> trackname3 Then
If track22 <> trackname4 Then
If track22 <> trackname5 Then
If track22 <> trackname6 Then
If track22 <> trackname7 Then
If track22 <> trackname8 Then
If track22 <> trackname9 Then
If track22 <> trackname10 Then
If track22 <> trackname11 Then
If track22 <> trackname12 Then
If track22 <> trackname13 Then
If track22 <> trackname14 Then
If track22 <> trackname15 Then
If track22 <> trackname16 Then
If track22 <> trackname17 Then
If track22 <> trackname18 Then
If track22 <> trackname19 Then
If track22 <> trackname20 Then
If track22 <> trackname21 Then
If track22 <> trackname22 Then
If track22 <> trackname23 Then
If track22 <> trackname24 Then
If track22 <> trackname25 Then
If track22 <> trackname26 Then
If track22 <> trackname27 Then
If track22 <> trackname28 Then
If track22 <> trackname29 Then
If track22 <> trackname30 Then
If track22 <> trackname31 Then
If track22 <> trackname32 Then
If track22 <> trackname33 Then
If track22 <> trackname34 Then
If track22 <> trackname35 Then
If track22 <> trackname36 Then
If track22 <> trackname37 Then
If track22 <> trackname38 Then
If track22 <> trackname39 Then
If energymatch = E22 Or energymatch = E22 + 1 Or energymatch = E22 - 1 Then
If matchingkey = K22 Or matchingkey2 = K22 Or matchingkey3 = K22 Or matchingkey4 = K22 Or matchingkey5 = K22 Then
Range("v24:ae24").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track23 <> trackname Then
If track23 <> trackname2 Then
If track23 <> trackname3 Then
If track23 <> trackname4 Then
If track23 <> trackname5 Then
If track23 <> trackname6 Then
If track23 <> trackname7 Then
If track23 <> trackname8 Then
If track23 <> trackname9 Then
If track23 <> trackname10 Then
If track23 <> trackname11 Then
If track23 <> trackname12 Then
If track23 <> trackname13 Then
If track23 <> trackname14 Then
If track23 <> trackname15 Then
If track23 <> trackname16 Then
If track23 <> trackname17 Then
If track23 <> trackname18 Then
If track23 <> trackname19 Then
If track23 <> trackname20 Then
If track23 <> trackname21 Then
If track23 <> trackname22 Then
If track23 <> trackname23 Then
If track23 <> trackname24 Then
If track23 <> trackname25 Then
If track23 <> trackname26 Then
If track23 <> trackname27 Then
If track23 <> trackname28 Then
If track23 <> trackname29 Then
If track23 <> trackname30 Then
If track23 <> trackname31 Then
If track23 <> trackname32 Then
If track23 <> trackname33 Then
If track23 <> trackname34 Then
If track23 <> trackname35 Then
If track23 <> trackname36 Then
If track23 <> trackname37 Then
If track23 <> trackname38 Then
If track23 <> trackname39 Then
If energymatch = E23 Or energymatch = E23 + 1 Or energymatch = E23 - 1 Then
If matchingkey = K23 Or matchingkey2 = K23 Or matchingkey3 = K23 Or matchingkey4 = K23 Or matchingkey5 = K23 Then
Range("v25:ae25").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track24 <> trackname Then
If track24 <> trackname2 Then
If track24 <> trackname3 Then
If track24 <> trackname4 Then
If track24 <> trackname5 Then
If track24 <> trackname6 Then
If track24 <> trackname7 Then
If track24 <> trackname8 Then
If track24 <> trackname9 Then
If track24 <> trackname10 Then
If track24 <> trackname11 Then
If track24 <> trackname12 Then
If track24 <> trackname13 Then
If track24 <> trackname14 Then
If track24 <> trackname15 Then
If track24 <> trackname16 Then
If track24 <> trackname17 Then
If track24 <> trackname18 Then
If track24 <> trackname19 Then
If track24 <> trackname20 Then
If track24 <> trackname21 Then
If track24 <> trackname22 Then
If track24 <> trackname23 Then
If track24 <> trackname24 Then
If track24 <> trackname25 Then
If track24 <> trackname26 Then
If track24 <> trackname27 Then
If track24 <> trackname28 Then
If track24 <> trackname29 Then
If track24 <> trackname30 Then
If track24 <> trackname31 Then
If track24 <> trackname32 Then
If track24 <> trackname33 Then
If track24 <> trackname34 Then
If track24 <> trackname35 Then
If track24 <> trackname36 Then
If track24 <> trackname37 Then
If track24 <> trackname38 Then
If track24 <> trackname39 Then
If energymatch = E24 Or energymatch = E24 + 1 Or energymatch = E24 - 1 Then
If matchingkey = K24 Or matchingkey2 = K24 Or matchingkey3 = K24 Or matchingkey4 = K24 Or matchingkey5 = K24 Then
Range("v26:ae26").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track25 <> trackname Then
If track25 <> trackname2 Then
If track25 <> trackname3 Then
If track25 <> trackname4 Then
If track25 <> trackname5 Then
If track25 <> trackname6 Then
If track25 <> trackname7 Then
If track25 <> trackname8 Then
If track25 <> trackname9 Then
If track25 <> trackname10 Then
If track25 <> trackname11 Then
If track25 <> trackname12 Then
If track25 <> trackname13 Then
If track25 <> trackname14 Then
If track25 <> trackname15 Then
If track25 <> trackname16 Then
If track25 <> trackname17 Then
If track25 <> trackname18 Then
If track25 <> trackname19 Then
If track25 <> trackname20 Then
If track25 <> trackname21 Then
If track25 <> trackname22 Then
If track25 <> trackname23 Then
If track25 <> trackname24 Then
If track25 <> trackname25 Then
If track25 <> trackname26 Then
If track25 <> trackname27 Then
If track25 <> trackname28 Then
If track25 <> trackname29 Then
If track25 <> trackname30 Then
If track25 <> trackname31 Then
If track25 <> trackname32 Then
If track25 <> trackname33 Then
If track25 <> trackname34 Then
If track25 <> trackname35 Then
If track25 <> trackname36 Then
If track25 <> trackname37 Then
If track25 <> trackname38 Then
If track25 <> trackname39 Then
If energymatch = E25 Or energymatch = E25 + 1 Or energymatch = E25 - 1 Then
If matchingkey = K25 Or matchingkey2 = K25 Or matchingkey3 = K25 Or matchingkey4 = K25 Or matchingkey5 = K25 Then
Range("v27:ae27").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track26 <> trackname Then
If track26 <> trackname2 Then
If track26 <> trackname3 Then
If track26 <> trackname4 Then
If track26 <> trackname5 Then
If track26 <> trackname6 Then
If track26 <> trackname7 Then
If track26 <> trackname8 Then
If track26 <> trackname9 Then
If track26 <> trackname10 Then
If track26 <> trackname11 Then
If track26 <> trackname12 Then
If track26 <> trackname13 Then
If track26 <> trackname14 Then
If track26 <> trackname15 Then
If track26 <> trackname16 Then
If track26 <> trackname17 Then
If track26 <> trackname18 Then
If track26 <> trackname19 Then
If track26 <> trackname20 Then
If track26 <> trackname21 Then
If track26 <> trackname22 Then
If track26 <> trackname23 Then
If track26 <> trackname24 Then
If track26 <> trackname25 Then
If track26 <> trackname26 Then
If track26 <> trackname27 Then
If track26 <> trackname28 Then
If track26 <> trackname29 Then
If track26 <> trackname30 Then
If track26 <> trackname31 Then
If track26 <> trackname32 Then
If track26 <> trackname33 Then
If track26 <> trackname34 Then
If track26 <> trackname35 Then
If track26 <> trackname36 Then
If track26 <> trackname37 Then
If track26 <> trackname38 Then
If track26 <> trackname39 Then
If energymatch = E26 Or energymatch = E26 + 1 Or energymatch = E26 - 1 Then
If matchingkey = K26 Or matchingkey2 = K26 Or matchingkey3 = K26 Or matchingkey4 = K26 Or matchingkey5 = K26 Then
Range("v28:ae28").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track27 <> trackname Then
If track27 <> trackname2 Then
If track27 <> trackname3 Then
If track27 <> trackname4 Then
If track27 <> trackname5 Then
If track27 <> trackname6 Then
If track27 <> trackname7 Then
If track27 <> trackname8 Then
If track27 <> trackname9 Then
If track27 <> trackname10 Then
If track27 <> trackname11 Then
If track27 <> trackname12 Then
If track27 <> trackname13 Then
If track27 <> trackname14 Then
If track27 <> trackname15 Then
If track27 <> trackname16 Then
If track27 <> trackname17 Then
If track27 <> trackname18 Then
If track27 <> trackname19 Then
If track27 <> trackname20 Then
If track27 <> trackname21 Then
If track27 <> trackname22 Then
If track27 <> trackname23 Then
If track27 <> trackname24 Then
If track27 <> trackname25 Then
If track27 <> trackname26 Then
If track27 <> trackname27 Then
If track27 <> trackname28 Then
If track27 <> trackname29 Then
If track27 <> trackname30 Then
If track27 <> trackname31 Then
If track27 <> trackname32 Then
If track27 <> trackname33 Then
If track27 <> trackname34 Then
If track27 <> trackname35 Then
If track27 <> trackname36 Then
If track27 <> trackname37 Then
If track27 <> trackname38 Then
If track27 <> trackname39 Then
If energymatch = E27 Or energymatch = E27 + 1 Or energymatch = E27 - 1 Then
If matchingkey = K27 Or matchingkey2 = K27 Or matchingkey3 = K27 Or matchingkey4 = K27 Or matchingkey5 = K27 Then
Range("v29:ae29").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track28 <> trackname Then
If track28 <> trackname2 Then
If track28 <> trackname3 Then
If track28 <> trackname4 Then
If track28 <> trackname5 Then
If track28 <> trackname6 Then
If track28 <> trackname7 Then
If track28 <> trackname8 Then
If track28 <> trackname9 Then
If track28 <> trackname10 Then
If track28 <> trackname11 Then
If track28 <> trackname12 Then
If track28 <> trackname13 Then
If track28 <> trackname14 Then
If track28 <> trackname15 Then
If track28 <> trackname16 Then
If track28 <> trackname17 Then
If track28 <> trackname18 Then
If track28 <> trackname19 Then
If track28 <> trackname20 Then
If track28 <> trackname21 Then
If track28 <> trackname22 Then
If track28 <> trackname23 Then
If track28 <> trackname24 Then
If track28 <> trackname25 Then
If track28 <> trackname26 Then
If track28 <> trackname27 Then
If track28 <> trackname28 Then
If track28 <> trackname29 Then
If track28 <> trackname30 Then
If track28 <> trackname31 Then
If track28 <> trackname32 Then
If track28 <> trackname33 Then
If track28 <> trackname34 Then
If track28 <> trackname35 Then
If track28 <> trackname36 Then
If track28 <> trackname37 Then
If track28 <> trackname38 Then
If track28 <> trackname39 Then
If energymatch = E28 Or energymatch = E28 + 1 Or energymatch = E28 - 1 Then
If matchingkey = K28 Or matchingkey2 = K28 Or matchingkey3 = K28 Or matchingkey4 = K28 Or matchingkey5 = K28 Then
Range("v30:ae30").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track29 <> trackname Then
If track29 <> trackname2 Then
If track29 <> trackname3 Then
If track29 <> trackname4 Then
If track29 <> trackname5 Then
If track29 <> trackname6 Then
If track29 <> trackname7 Then
If track29 <> trackname8 Then
If track29 <> trackname9 Then
If track29 <> trackname10 Then
If track29 <> trackname11 Then
If track29 <> trackname12 Then
If track29 <> trackname13 Then
If track29 <> trackname14 Then
If track29 <> trackname15 Then
If track29 <> trackname16 Then
If track29 <> trackname17 Then
If track29 <> trackname18 Then
If track29 <> trackname19 Then
If track29 <> trackname20 Then
If track29 <> trackname21 Then
If track29 <> trackname22 Then
If track29 <> trackname23 Then
If track29 <> trackname24 Then
If track29 <> trackname25 Then
If track29 <> trackname26 Then
If track29 <> trackname27 Then
If track29 <> trackname28 Then
If track29 <> trackname29 Then
If track29 <> trackname30 Then
If track29 <> trackname31 Then
If track29 <> trackname32 Then
If track29 <> trackname33 Then
If track29 <> trackname34 Then
If track29 <> trackname35 Then
If track29 <> trackname36 Then
If track29 <> trackname37 Then
If track29 <> trackname38 Then
If track29 <> trackname39 Then
If energymatch = E29 Or energymatch = E29 + 1 Or energymatch = E29 - 1 Then
If matchingkey = K29 Or matchingkey2 = K29 Or matchingkey3 = K29 Or matchingkey4 = K29 Or matchingkey5 = K29 Then
Range("v31:ae31").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track30 <> trackname Then
If track30 <> trackname2 Then
If track30 <> trackname3 Then
If track30 <> trackname4 Then
If track30 <> trackname5 Then
If track30 <> trackname6 Then
If track30 <> trackname7 Then
If track30 <> trackname8 Then
If track30 <> trackname9 Then
If track30 <> trackname10 Then
If track30 <> trackname11 Then
If track30 <> trackname12 Then
If track30 <> trackname13 Then
If track30 <> trackname14 Then
If track30 <> trackname15 Then
If track30 <> trackname16 Then
If track30 <> trackname17 Then
If track30 <> trackname18 Then
If track30 <> trackname19 Then
If track30 <> trackname20 Then
If track30 <> trackname21 Then
If track30 <> trackname22 Then
If track30 <> trackname23 Then
If track30 <> trackname24 Then
If track30 <> trackname25 Then
If track30 <> trackname26 Then
If track30 <> trackname27 Then
If track30 <> trackname28 Then
If track30 <> trackname29 Then
If track30 <> trackname30 Then
If track30 <> trackname31 Then
If track30 <> trackname32 Then
If track30 <> trackname33 Then
If track30 <> trackname34 Then
If track30 <> trackname35 Then
If track30 <> trackname36 Then
If track30 <> trackname37 Then
If track30 <> trackname38 Then
If track30 <> trackname39 Then
If energymatch = E30 Or energymatch = E30 + 1 Or energymatch = E30 - 1 Then
If matchingkey = K30 Or matchingkey2 = K30 Or matchingkey3 = K30 Or matchingkey4 = K30 Or matchingkey5 = K30 Then
Range("v32:ae32").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track31 <> trackname Then
If track31 <> trackname2 Then
If track31 <> trackname3 Then
If track31 <> trackname4 Then
If track31 <> trackname5 Then
If track31 <> trackname6 Then
If track31 <> trackname7 Then
If track31 <> trackname8 Then
If track31 <> trackname9 Then
If track31 <> trackname10 Then
If track31 <> trackname11 Then
If track31 <> trackname12 Then
If track31 <> trackname13 Then
If track31 <> trackname14 Then
If track31 <> trackname15 Then
If track31 <> trackname16 Then
If track31 <> trackname17 Then
If track31 <> trackname18 Then
If track31 <> trackname19 Then
If track31 <> trackname20 Then
If track31 <> trackname21 Then
If track31 <> trackname22 Then
If track31 <> trackname23 Then
If track31 <> trackname24 Then
If track31 <> trackname25 Then
If track31 <> trackname26 Then
If track31 <> trackname27 Then
If track31 <> trackname28 Then
If track31 <> trackname29 Then
If track31 <> trackname30 Then
If track31 <> trackname31 Then
If track31 <> trackname32 Then
If track31 <> trackname33 Then
If track31 <> trackname34 Then
If track31 <> trackname35 Then
If track31 <> trackname36 Then
If track31 <> trackname37 Then
If track31 <> trackname38 Then
If track31 <> trackname39 Then
If energymatch = E31 Or energymatch = E31 + 1 Or energymatch = E31 - 1 Then
If matchingkey = K31 Or matchingkey2 = K31 Or matchingkey3 = K31 Or matchingkey4 = K31 Or matchingkey5 = K31 Then
Range("v33:ae33").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track32 <> trackname Then
If track32 <> trackname2 Then
If track32 <> trackname3 Then
If track32 <> trackname4 Then
If track32 <> trackname5 Then
If track32 <> trackname6 Then
If track32 <> trackname7 Then
If track32 <> trackname8 Then
If track32 <> trackname9 Then
If track32 <> trackname10 Then
If track32 <> trackname11 Then
If track32 <> trackname12 Then
If track32 <> trackname13 Then
If track32 <> trackname14 Then
If track32 <> trackname15 Then
If track32 <> trackname16 Then
If track32 <> trackname17 Then
If track32 <> trackname18 Then
If track32 <> trackname19 Then
If track32 <> trackname20 Then
If track32 <> trackname21 Then
If track32 <> trackname22 Then
If track32 <> trackname23 Then
If track32 <> trackname24 Then
If track32 <> trackname25 Then
If track32 <> trackname26 Then
If track32 <> trackname27 Then
If track32 <> trackname28 Then
If track32 <> trackname29 Then
If track32 <> trackname30 Then
If track32 <> trackname31 Then
If track32 <> trackname32 Then
If track32 <> trackname33 Then
If track32 <> trackname34 Then
If track32 <> trackname35 Then
If track32 <> trackname36 Then
If track32 <> trackname37 Then
If track32 <> trackname38 Then
If track32 <> trackname39 Then
If energymatch = E32 Or energymatch = E32 + 1 Or energymatch = E32 - 1 Then
If matchingkey = K32 Or matchingkey2 = K32 Or matchingkey3 = K32 Or matchingkey4 = K32 Or matchingkey5 = K32 Then
Range("v34:ae34").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track33 <> trackname Then
If track33 <> trackname2 Then
If track33 <> trackname3 Then
If track33 <> trackname4 Then
If track33 <> trackname5 Then
If track33 <> trackname6 Then
If track33 <> trackname7 Then
If track33 <> trackname8 Then
If track33 <> trackname9 Then
If track33 <> trackname10 Then
If track33 <> trackname11 Then
If track33 <> trackname12 Then
If track33 <> trackname13 Then
If track33 <> trackname14 Then
If track33 <> trackname15 Then
If track33 <> trackname16 Then
If track33 <> trackname17 Then
If track33 <> trackname18 Then
If track33 <> trackname19 Then
If track33 <> trackname20 Then
If track33 <> trackname21 Then
If track33 <> trackname22 Then
If track33 <> trackname23 Then
If track33 <> trackname24 Then
If track33 <> trackname25 Then
If track33 <> trackname26 Then
If track33 <> trackname27 Then
If track33 <> trackname28 Then
If track33 <> trackname29 Then
If track33 <> trackname30 Then
If track33 <> trackname31 Then
If track33 <> trackname32 Then
If track33 <> trackname33 Then
If track33 <> trackname34 Then
If track33 <> trackname35 Then
If track33 <> trackname36 Then
If track33 <> trackname37 Then
If track33 <> trackname38 Then
If track33 <> trackname39 Then
If energymatch = E33 Or energymatch = E33 + 1 Or energymatch = E33 - 1 Then
If matchingkey = K33 Or matchingkey2 = K33 Or matchingkey3 = K33 Or matchingkey4 = K33 Or matchingkey5 = K33 Then
Range("v35:ae35").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track34 <> trackname Then
If track34 <> trackname2 Then
If track34 <> trackname3 Then
If track34 <> trackname4 Then
If track34 <> trackname5 Then
If track34 <> trackname6 Then
If track34 <> trackname7 Then
If track34 <> trackname8 Then
If track34 <> trackname9 Then
If track34 <> trackname10 Then
If track34 <> trackname11 Then
If track34 <> trackname12 Then
If track34 <> trackname13 Then
If track34 <> trackname14 Then
If track34 <> trackname15 Then
If track34 <> trackname16 Then
If track34 <> trackname17 Then
If track34 <> trackname18 Then
If track34 <> trackname19 Then
If track34 <> trackname20 Then
If track34 <> trackname21 Then
If track34 <> trackname22 Then
If track34 <> trackname23 Then
If track34 <> trackname24 Then
If track34 <> trackname25 Then
If track34 <> trackname26 Then
If track34 <> trackname27 Then
If track34 <> trackname28 Then
If track34 <> trackname29 Then
If track34 <> trackname30 Then
If track34 <> trackname31 Then
If track34 <> trackname32 Then
If track34 <> trackname33 Then
If track34 <> trackname34 Then
If track34 <> trackname35 Then
If track34 <> trackname36 Then
If track34 <> trackname37 Then
If track34 <> trackname38 Then
If track34 <> trackname39 Then
If energymatch = E34 Or energymatch = E34 + 1 Or energymatch = E34 - 1 Then
If matchingkey = K34 Or matchingkey2 = K34 Or matchingkey3 = K34 Or matchingkey4 = K34 Or matchingkey5 = K34 Then
Range("v36:ae36").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track35 <> trackname Then
If track35 <> trackname2 Then
If track35 <> trackname3 Then
If track35 <> trackname4 Then
If track35 <> trackname5 Then
If track35 <> trackname6 Then
If track35 <> trackname7 Then
If track35 <> trackname8 Then
If track35 <> trackname9 Then
If track35 <> trackname10 Then
If track35 <> trackname11 Then
If track35 <> trackname12 Then
If track35 <> trackname13 Then
If track35 <> trackname14 Then
If track35 <> trackname15 Then
If track35 <> trackname16 Then
If track35 <> trackname17 Then
If track35 <> trackname18 Then
If track35 <> trackname19 Then
If track35 <> trackname20 Then
If track35 <> trackname21 Then
If track35 <> trackname22 Then
If track35 <> trackname23 Then
If track35 <> trackname24 Then
If track35 <> trackname25 Then
If track35 <> trackname26 Then
If track35 <> trackname27 Then
If track35 <> trackname28 Then
If track35 <> trackname29 Then
If track35 <> trackname30 Then
If track35 <> trackname31 Then
If track35 <> trackname32 Then
If track35 <> trackname33 Then
If track35 <> trackname34 Then
If track35 <> trackname35 Then
If track35 <> trackname36 Then
If track35 <> trackname37 Then
If track35 <> trackname38 Then
If track35 <> trackname39 Then
If energymatch = E35 Or energymatch = E35 + 1 Or energymatch = E35 - 1 Then
If matchingkey = K35 Or matchingkey2 = K35 Or matchingkey3 = K35 Or matchingkey4 = K35 Or matchingkey5 = K35 Then
Range("v37:ae37").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track36 <> trackname Then
If track36 <> trackname2 Then
If track36 <> trackname3 Then
If track36 <> trackname4 Then
If track36 <> trackname5 Then
If track36 <> trackname6 Then
If track36 <> trackname7 Then
If track36 <> trackname8 Then
If track36 <> trackname9 Then
If track36 <> trackname10 Then
If track36 <> trackname11 Then
If track36 <> trackname12 Then
If track36 <> trackname13 Then
If track36 <> trackname14 Then
If track36 <> trackname15 Then
If track36 <> trackname16 Then
If track36 <> trackname17 Then
If track36 <> trackname18 Then
If track36 <> trackname19 Then
If track36 <> trackname20 Then
If track36 <> trackname21 Then
If track36 <> trackname22 Then
If track36 <> trackname23 Then
If track36 <> trackname24 Then
If track36 <> trackname25 Then
If track36 <> trackname26 Then
If track36 <> trackname27 Then
If track36 <> trackname28 Then
If track36 <> trackname29 Then
If track36 <> trackname30 Then
If track36 <> trackname31 Then
If track36 <> trackname32 Then
If track36 <> trackname33 Then
If track36 <> trackname34 Then
If track36 <> trackname35 Then
If track36 <> trackname36 Then
If track36 <> trackname37 Then
If track36 <> trackname38 Then
If track36 <> trackname39 Then
If energymatch = E36 Or energymatch = E36 + 1 Or energymatch = E36 - 1 Then
If matchingkey = K36 Or matchingkey2 = K36 Or matchingkey3 = K36 Or matchingkey4 = K36 Or matchingkey5 = K36 Then
Range("v38:ae38").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track37 <> trackname Then
If track37 <> trackname2 Then
If track37 <> trackname3 Then
If track37 <> trackname4 Then
If track37 <> trackname5 Then
If track37 <> trackname6 Then
If track37 <> trackname7 Then
If track37 <> trackname8 Then
If track37 <> trackname9 Then
If track37 <> trackname10 Then
If track37 <> trackname11 Then
If track37 <> trackname12 Then
If track37 <> trackname13 Then
If track37 <> trackname14 Then
If track37 <> trackname15 Then
If track37 <> trackname16 Then
If track37 <> trackname17 Then
If track37 <> trackname18 Then
If track37 <> trackname19 Then
If track37 <> trackname20 Then
If track37 <> trackname21 Then
If track37 <> trackname22 Then
If track37 <> trackname23 Then
If track37 <> trackname24 Then
If track37 <> trackname25 Then
If track37 <> trackname26 Then
If track37 <> trackname27 Then
If track37 <> trackname28 Then
If track37 <> trackname29 Then
If track37 <> trackname30 Then
If track37 <> trackname31 Then
If track37 <> trackname32 Then
If track37 <> trackname33 Then
If track37 <> trackname34 Then
If track37 <> trackname35 Then
If track37 <> trackname36 Then
If track37 <> trackname37 Then
If track37 <> trackname38 Then
If track37 <> trackname39 Then
If energymatch = E37 Or energymatch = E37 + 1 Or energymatch = E37 - 1 Then
If matchingkey = K37 Or matchingkey2 = K37 Or matchingkey3 = K37 Or matchingkey4 = K37 Or matchingkey5 = K37 Then
Range("v39:ae39").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track38 <> trackname Then
If track38 <> trackname2 Then
If track38 <> trackname3 Then
If track38 <> trackname4 Then
If track38 <> trackname5 Then
If track38 <> trackname6 Then
If track38 <> trackname7 Then
If track38 <> trackname8 Then
If track38 <> trackname9 Then
If track38 <> trackname10 Then
If track38 <> trackname11 Then
If track38 <> trackname12 Then
If track38 <> trackname13 Then
If track38 <> trackname14 Then
If track38 <> trackname15 Then
If track38 <> trackname16 Then
If track38 <> trackname17 Then
If track38 <> trackname18 Then
If track38 <> trackname19 Then
If track38 <> trackname20 Then
If track38 <> trackname21 Then
If track38 <> trackname22 Then
If track38 <> trackname23 Then
If track38 <> trackname24 Then
If track38 <> trackname25 Then
If track38 <> trackname26 Then
If track38 <> trackname27 Then
If track38 <> trackname28 Then
If track38 <> trackname29 Then
If track38 <> trackname30 Then
If track38 <> trackname31 Then
If track38 <> trackname32 Then
If track38 <> trackname33 Then
If track38 <> trackname34 Then
If track38 <> trackname35 Then
If track38 <> trackname36 Then
If track38 <> trackname37 Then
If track38 <> trackname38 Then
If track38 <> trackname39 Then
If energymatch = E38 Or energymatch = E38 + 1 Or energymatch = E38 - 1 Then
If matchingkey = K38 Or matchingkey2 = K38 Or matchingkey3 = K38 Or matchingkey4 = K38 Or matchingkey5 = K38 Then
Range("v40:ae40").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track39 <> trackname Then
If track39 <> trackname2 Then
If track39 <> trackname3 Then
If track39 <> trackname4 Then
If track39 <> trackname5 Then
If track39 <> trackname6 Then
If track39 <> trackname7 Then
If track39 <> trackname8 Then
If track39 <> trackname9 Then
If track39 <> trackname10 Then
If track39 <> trackname11 Then
If track39 <> trackname12 Then
If track39 <> trackname13 Then
If track39 <> trackname14 Then
If track39 <> trackname15 Then
If track39 <> trackname16 Then
If track39 <> trackname17 Then
If track39 <> trackname18 Then
If track39 <> trackname19 Then
If track39 <> trackname20 Then
If track39 <> trackname21 Then
If track39 <> trackname22 Then
If track39 <> trackname23 Then
If track39 <> trackname24 Then
If track39 <> trackname25 Then
If track39 <> trackname26 Then
If track39 <> trackname27 Then
If track39 <> trackname28 Then
If track39 <> trackname29 Then
If track39 <> trackname30 Then
If track39 <> trackname31 Then
If track39 <> trackname32 Then
If track39 <> trackname33 Then
If track39 <> trackname34 Then
If track39 <> trackname35 Then
If track39 <> trackname36 Then
If track39 <> trackname37 Then
If track39 <> trackname38 Then
If track39 <> trackname39 Then
If energymatch = E39 Or energymatch = E39 + 1 Or energymatch = E39 - 1 Then
If matchingkey = K39 Or matchingkey2 = K39 Or matchingkey3 = K39 Or matchingkey4 = K39 Or matchingkey5 = K39 Then
Range("v41:ae41").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Range("ag42").Value = "" Then
If track40 <> trackname Then
If track40 <> trackname2 Then
If track40 <> trackname3 Then
If track40 <> trackname4 Then
If track40 <> trackname5 Then
If track40 <> trackname6 Then
If track40 <> trackname7 Then
If track40 <> trackname8 Then
If track40 <> trackname9 Then
If track40 <> trackname10 Then
If track40 <> trackname11 Then
If track40 <> trackname12 Then
If track40 <> trackname13 Then
If track40 <> trackname14 Then
If track40 <> trackname15 Then
If track40 <> trackname16 Then
If track40 <> trackname17 Then
If track40 <> trackname18 Then
If track40 <> trackname19 Then
If track40 <> trackname20 Then
If track40 <> trackname21 Then
If track40 <> trackname22 Then
If track40 <> trackname23 Then
If track40 <> trackname24 Then
If track40 <> trackname25 Then
If track40 <> trackname26 Then
If track40 <> trackname27 Then
If track40 <> trackname28 Then
If track40 <> trackname29 Then
If track40 <> trackname30 Then
If track40 <> trackname31 Then
If track40 <> trackname32 Then
If track40 <> trackname33 Then
If track40 <> trackname34 Then
If track40 <> trackname35 Then
If track40 <> trackname36 Then
If track40 <> trackname37 Then
If track40 <> trackname38 Then
If track40 <> trackname39 Then
If energymatch = E40 Or energymatch = E40 + 1 Or energymatch = E40 - 1 Then
If matchingkey = K40 Or matchingkey2 = K40 Or matchingkey3 = K40 Or matchingkey4 = K40 Or matchingkey5 = K40 Then
Range("v42:ae42").Copy
Range("ag42").Select
ActiveSheet.Paste
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
Sorry if this looks a bit crazy. It works for what I want it to do, it's just not practical. Any help would be appreciated, even if it can reduce the IFS down a bit.#
Thanks