View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Connie Connie is offline
external usenet poster
 
Posts: 106
Default Determine if any Cell in Range Equals a String

I am using the following code to check for errors before appending data
to a sheet in the workbook. I get a data type mismatch for the first
second line:

If Sheets("Error Report").Range("E11:E67") = "Error" Then

How do I check the range E11:E67 on the sheet "Error Report" to
determine if any cell in that range is equal to "Error"?

Private Sub CommandButton4_Click()

'Check for Errors
If Sheets("Error Report").Range("E11:E67") = "Error" Then
MsgBox "You have unresolved ERRORS. Please View Report and
resolve all ERRORS before proceeding."
Exit Sub
Else
'Export Data
ActiveWindow.ScrollWorkbookTabs Sheets:=1
Sheets("Summary Totals").Select
Sheets("Summary Totals").Range("A9:O15").Select
Selection.Copy
Sheets("Compiled Totals").Select
Sheets("Compiled Totals").Range("A9").Select
Do Until ActiveCell.Offset(0, 1).Value = ""
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Field Rep Time Sheet").Select
Range("A19").Select
End If
End Sub

Thanks. Connie