So Strange, I have similar statements through out my VBA program, and yet this one is giving me a problem. I have verified that the named range is accurately listed.
Dim strWarning As String
strWarning = Sheet3.Range("Dte_MissingFlag") 'Initiates to "N"
... some decision logic to flip the strWarning Flag to "Y" or "N"...
If Range("Dte_MissingFlag") <> strWarning Then
Range("Dte_MissingFlag") = strWarning
end if
Error occurs inside the If clause.
1004: Application-defined or object-defined error
Debugging Completed to date: 1) While running, test in the immediate window
?strWarning
>returns "x"
?Range("Dte_MissingFlag")
>returns null/empty
2) Run the statement Range("Dte_MissingFlag") = "x" in the immediate window with no problem.
I've read around a bit and most of these errors are due to invalid references to ranges or cells. I've tried using Sheet("name").Range("cell").value, and still get the same error.
Any thoughts on this one? Thanks in advance.
... some decision logic...bit to see if it still fails. - tospigOption Explicitin the declarations section (top) of the module code page? Does Formulas ► Name Manager report Dte_MissingFlag as workbook or worksheet scope? You are using the Sheet3 codename initially but omitting it later on in the code. - user4039065