CODE DOES NOT RUN - No Errors, just doesn't run

Sphinx404

Board Regular
Joined
May 2, 2015
Messages
186
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

I worked on a code over the weekend on my computer at home, which has Excel 2016. This code worked over the weekend on my computer at home, but I haven't been able to get it to run on my work computer (Excel 2013).

I'm not sure the differences in Excel builds are the problem... The code just doesn't run... at all. It doesn't throw errors... After I press F5, nothing happens.... no hour glass, no nothing. Does anyone see something in this code that I don't?

Code:
Sub Step16()
'*************CODE DOES NOT RUN.... WHY?***************




Dim row As Double
Dim code1 As String
Dim code2 As String
Dim code3 As String
Dim match1 As String
Dim match2 As String
Dim match3 As String


row = 2


match1 = ""
match2 = ""
match3 = ""


Do Until Range("AK" & row).FormulaR1C1 = ""


code1 = Range("AK" & row).Value = "VLOOKUP(C2,IMP.SPL!$A$2:$D$44,2,0)"
code2 = Range("AL" & row).Value = "VLOOKUP(C2,IMP.SPL!$A$2:$D$44,3,0)"
code3 = Range("AM" & row).Value = "VLOOKUP(C2,IMP.SPL!$A$2:$D$44,4,0)"


If code1 = Range("AN" & row).Value Then match1 = "MATCH"
If code1 = Range("AO" & row).Value Then match1 = "MATCH"
If code1 = Range("AP" & row).Value Then match1 = "MATCH"
If code1 = Range("AQ" & row).Value Then match1 = "MATCH"
If code1 = Range("AR" & row).Value Then match1 = "MATCH"


If code2 = Range("AN" & row).Value Then match2 = "MATCH"
If code2 = Range("AO" & row).Value Then match2 = "MATCH"
If code2 = Range("AP" & row).Value Then match2 = "MATCH"
If code2 = Range("AQ" & row).Value Then match2 = "MATCH"
If code2 = Range("AR" & row).Value Then match2 = "MATCH"


If code3 = Range("AN" & row).Value Then match3 = "MATCH"
If code3 = Range("AO" & row).Value Then match3 = "MATCH"
If code3 = Range("AP" & row).Value Then match3 = "MATCH"
If code3 = Range("AQ" & row).Value Then match3 = "MATCH"
If code3 = Range("AR" & row).Value Then match3 = "MATCH"


If match1 = "MATCH" Then
    Range("AS" & row).Value = "MATCHES"
Else
    If match2 = "MATCH" Then
        Range("AS" & row).Value = "MATCHES"
    Else
        If match3 = "MATCH" Then
            Range("AS" & row).Value = "MATCHES"
        Else
            Range("AS" & row).Value = "NO MATCHES"
        End If
    End If
End If
row = row + 1


Loop


End Sub

Thank you Gentleman!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hello

What do you intend to achieve with these lines?
Code:
code1 = Range("AK" & row).Value = "VLOOKUP(C2,IMP.SPL!$A$2:$D$44,2,0)"
code2 = Range("AL" & row).Value = "VLOOKUP(C2,IMP.SPL!$A$2:$D$44,3,0)"
code3 = Range("AM" & row).Value = "VLOOKUP(C2,IMP.SPL!$A$2:$D$44,4,0)"
 
Upvote 0
Hello

What do you intend to achieve with these lines?
Code:
code1 = Range("AK" & row).Value = "VLOOKUP(C2,IMP.SPL!$A$2:$D$44,2,0)"
code2 = Range("AL" & row).Value = "VLOOKUP(C2,IMP.SPL!$A$2:$D$44,3,0)"
code3 = Range("AM" & row).Value = "VLOOKUP(C2,IMP.SPL!$A$2:$D$44,4,0)"

I have 1 value (i.e. "UN1139")

This can be found in sheet("IMP.SPL") and needs to return the indicator (i.e. :"RCM" or "RLF" or "RRE"). It can be 1, 2, or 3 indicators of over 1,000 indicators.

each UN1139 has up to 3 indicators

Code1 - tells me the first indicator - VLOOKUP(C2,IMP.SPL!$A$2:$D$44,2,0)
Code2 - tells me the second indicator - VLOOKUP(C2,IMP.SPL!$A$2:$D$44,3,0)
Code3 - tells me the third indicator - VLOOKUP(C2,IMP.SPL!$A$2:$D$44,4,0)

THE REST OF THE CODE

Now I need to look for each of the 3 codes in.... OH NO! I just figured it out.

What in the heck. I'm supposed to be looking for the codes in a different sheet, but as you can see by the code above, its looking in cells that I haven't populated yet. Ugh I'm an idiot.
 
Upvote 0
Sphinx404,

I would suggest that you start by changing the following line of code:

Dim row As Double

to this:

Dim row As Long
 
Upvote 0

Forum statistics

Threads
1,215,639
Messages
6,125,971
Members
449,276
Latest member
surendra75

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top