PC Review


Reply
Thread Tools Rate Thread

Delete row if formula brings back an error

 
 
keri
Guest
Posts: n/a
 
      14th Dec 2006
Hi,

I have searched posts but can find nothing that covers this. I
originally thought the error brought back may be treated as a value,
and could delete the row based on this value but that doesn't seem to
work.

I have a formula operating in columns J & K on up to 26 sheets. When
the formula (in code) reaches the bottom of each sheet it may return
the error #VALUE! into J & K. This does not always happen.

What I would like to do is search for these #VALUE! cells and delete
the rows where they are found.

 
Reply With Quote
 
 
 
 
ankur
Guest
Posts: n/a
 
      14th Dec 2006

Hi Keri,

Try this.

Sub test()
For Each Sheet In ActiveWorkbook.Sheets
For Each cell In Sheet.Columns("J:K").Cells
If IsError(cell.Value) = True Then
Sheet.Rows(cell.Row).Delete (xlUp)
End If
Next cell

Next Sheet
End Sub


Regards
Ankur Kanchan
www.xlmacros.com


keri wrote:

> Hi,
>
> I have searched posts but can find nothing that covers this. I
> originally thought the error brought back may be treated as a value,
> and could delete the row based on this value but that doesn't seem to
> work.
>
> I have a formula operating in columns J & K on up to 26 sheets. When
> the formula (in code) reaches the bottom of each sheet it may return
> the error #VALUE! into J & K. This does not always happen.
>
> What I would like to do is search for these #VALUE! cells and delete
> the rows where they are found.


 
Reply With Quote
 
keri
Guest
Posts: n/a
 
      14th Dec 2006
Thankyou for this and putting me on the right track.


ankur wrote:
> Hi Keri,
>
> Try this.
>
> Sub test()
> For Each Sheet In ActiveWorkbook.Sheets
> For Each cell In Sheet.Columns("J:K").Cells
> If IsError(cell.Value) = True Then
> Sheet.Rows(cell.Row).Delete (xlUp)
> End If
> Next cell
>
> Next Sheet
> End Sub
>
>
> Regards
> Ankur Kanchan
> www.xlmacros.com
>
>
> keri wrote:
>
> > Hi,
> >
> > I have searched posts but can find nothing that covers this. I
> > originally thought the error brought back may be treated as a value,
> > and could delete the row based on this value but that doesn't seem to
> > work.
> >
> > I have a formula operating in columns J & K on up to 26 sheets. When
> > the formula (in code) reaches the bottom of each sheet it may return
> > the error #VALUE! into J & K. This does not always happen.
> >
> > What I would like to do is search for these #VALUE! cells and delete
> > the rows where they are found.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum brings back null Value =?Utf-8?B?UmVkRGV2aWw=?= Microsoft Excel Misc 2 2nd Apr 2007 11:47 AM
CLICKING ON LOG IN BRINGS ME BACK TO LOG IN =?Utf-8?B?QlJJQU4=?= Windows XP General 4 14th Aug 2006 03:41 AM
IE7 Beta 2 click back button brings back to home page Tony Lisanti Windows XP General 4 4th May 2006 06:29 AM
Back Button brings up old page? gt Windows XP Internet Explorer 1 11th Dec 2003 07:18 PM
back button brings up page cannot be displayed error message Ed Sanchez Windows XP Internet Explorer 1 21st Sep 2003 03:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:07 PM.