Thanks, Nick. Makes sense. I knew it was something obvious. The code
works. I was testing for the actual value of "Error" (in answer to
your question). Thanks again.
NickHK wrote:
> Connie
> You cannot compare a single value against a range of cells. You could loop
> through each cell testing its value, but it's quicker to get Excel to count
> them for you:
>
> If Application.CountIf(Sheets(1).Range("E11:E67"), "Error") > 0 Then
> MsgBox "You have unresolved ERRORS. Please View Report and resolve all
> ERRORS before proceeding."
> Exit Sub
> End If
>
> NickHK
>
> "Connie" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >
|