Cell is already a range, so you don't put it inside Range().
If IsEmpty(.Range(Cell)) Or .Range(Cell).Value <= 0 Then
should be more like:
If IsEmpty(Cell) Or Cell.Value <= 0 Then
And a few more to clean up, too.
"pjhageman <" wrote:
In the below code, I am receiving a Run-time error ‘1004’:
Application-defined or object-defined error. The line
If Empty(.Range…. is highlighted yellow. Could someone
suggest a fix? Thanks, Phil
Private Function CheckRange(Cell As Range)
Dim sMsg As String
With Worksheets("Scorecard")
If IsEmpty(.Range(Cell)) Or .Range(Cell).Value <= 0 Then
If .Range(Cell).MergeArea.Address(False, False) < Cell Then
sMsg = "Weight for Cell(s) " & _
Range(Cell).MergeArea.Address & _
" must be entered, and must be greater than
zero."
Else
sMsg = "Weight for cell " & _
Range(Cell).Address & _
" is required"
End If
CheckRange = sMsg & sMsg & vbCrLf
End If
End With
End Function
---
Message posted from http://www.ExcelForum.com/
--
Dave Peterson