Problem with array and msgbox

A

aking1987

Code
-------------------

Sub errorsandproblems()

For i = 14 To 156
If Worksheets("user editable sheet 1").Range("e" & i) = "<ERROR" Then
MsgBox "It appears that you are dumb, go back and fix it"
Else
End If
Next
End Su
-------------------


If this statement comes across multiple errors between cells 14 to 15
column e, then ONLY one msgbox is to be displayed.

How can i do this?

Antoni
 
B

Bernie Deitrick

Antonio,

Sub FixedProblem()
If Application.WorksheetFunction.CountIf(Range("E14:E156"), "<ERROR") > 1
Then
MsgBox "It appears that you are dumb, go back and fix it"
End If
End Sub

HTH,
Bernie
MS Excel MVP
 
B

Bernie Deitrick

arrrrrggh, crappy line wrap. The "Then" should be at the end of the long
line....

Sorry

Bernie
MS Excel MVP

Bernie Deitrick said:
Antonio,

Sub FixedProblem()
If Application.WorksheetFunction.CountIf(Range("E14:E156"), "<ERROR") > 1
Then
MsgBox "It appears that you are dumb, go back and fix it"
End If
End Sub

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top