Delete row if #REF! shown

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,699
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I am using this simple code =DATABASE!A202 & son on.
I have noticed that if nothing is in the cell in question then on the worksheet where there should be a value etc i see #REF !

Can we use some kind of code so that row is then deleted should #REF ! be in any cell in Column A

Thanks
 
OK
This is where i am so far.
The macro is DeleteRefErrors

I then have this,
Code:
Private Sub Worksheet_Activate()Call DeleteRefErrors
End Sub

It works as it should BUT it also advises me when no cells were found,meaning no errors on the page.
Is there a way to suppress this message.
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Try
Code:
Private Sub Workbook_Open()
   Worksheets("HONDA SHEET").Activate
   Range("A13").Select
   ActiveWindow.ScrollRow = 13
   With Worksheets("INV DETAILS")
      On Error Resume Next
      .Columns("A").SpecialCells(xlFormulas, xlErrors).EntireRow.Delete
      On Error GoTo 0
   End With
End Sub
 
Upvote 0
HI,
Where did HONDA SHEET A13 come from ?
Sorry my mistake
 
Last edited:
Upvote 0
Hi,
That codes shows me the same no cells found message.
I know the code is doing what it is supposed to do but i dont need to know no errors were found Ha Ha
 
Upvote 0
That codes shows me the same no cells found message.
In that case you didn't use the code I posted, as that will hide the error if it occurs
 
Upvote 0
This is what i have,
I noticed that your zero has a line through it but mine wont show like that



Code:
Private Sub Workbook_Open()   Worksheets("HONDA SHEET").Activate
   Range("A13").Select
   ActiveWindow.ScrollRow = 13
   With Worksheets("INV DETAILS")
      On Error Resume Next
      .Columns("A").SpecialCells(xlFormulas, xlErrors).EntireRow.Delete
      On Error GoTo 0
   End With
End Sub
 
Upvote 0
You should not be getting a "No cells were found" error with that code.
 
Upvote 0
Ive just checked and the code is the same.
I see the code each time i open the workbook.

If that wont work what if we show a msg box but then straight after hide it,basically anything.
 
Upvote 0
This line
Code:
      On Error Resume Next
suppresses all errors, so you should never get any error messages until after this line
Code:
      On Error GoTo 0
which sets the error handler back to the default.
Do you get any other error messages?
 
Upvote 0
NO,
This is what happens.
I open the workbook.
I then see this message.

"Run time error 1004" No cells were found.

If i click on debug this is shown in yellow.
.Columns("A").SpecialCells(xlFormulas, xlErrors).EntireRow.Delete

I only then see it again once the workbook is next open
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top