P
pjhageman
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
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