I cannot seem to get the range with cells to work from a worksheet module for a range on another worksheet.
The following code gives me an "application-defined or object-defined error" on the If statement line.
With Worksheets("ConceptData")
If Range("NumTechLines") <> .Range(.Cells(iRowNumber, 10)) Then MsgBox .Range(.Cells(iRowNumber, 10))
End With
When I replace the cells method with an absolute address "J6", I do not get the error. I have verified that the Range("NumTechLines") and iRowNumber are defined.

Referring to a range on another worksheet from within the worksheet module
Ken Lyon
m.singh
I would check where you've declared and set the value of iRowNumber; I set it locally in the procedure in the Sheet2 code as follows:
Sub go()
Dim iRowNumber As Integer
iRowNumber = 1
With Worksheets("ConceptData")
If .Range("NumTechLines") <> .Cells(iRowNumber, 10) Then MsgBox .Cells(iRowNumber, 10)
End With
End Sub
Tomas Restrepo
omarsaid
With Worksheets("ConceptData")
If .Range("NumTechLines") <> .Cells(iRowNumber, 10) Then MsgBox .Cells(iRowNumber, 10)
End With