delete row based on values....almost there

Skidood

New Member
Joined
Jan 1, 2018
Messages
35
Hi again, this code from Fluff has worked...I am summing all rows in column 77 and if the sum is 0.00, then a TRUE is assigned to the cell in the affected row in the summing column.


=IF(SUM(E11:BX11)<0.000001,TRUE,"")


I had to use .0000001 because it seems that excel doesn't want to distinguish between 0 and 0.00 in this particular case.

Anyway, my button code is this:



Sub CommandButton1_Click()
Columns(77).SpecialCells(xlFormulas, xlLogical).EntireRow.Delete


End Sub


However, I also want to delete any row where "#NUM!" or "REF!" shows up in column 77 (in addition to "TRUE")
Can anyone suggest the extra lines of code?


Excel 2010 32 bit
JBSBTBUBVBWBXBYBZ
6
7Column 77
8FT23Lethal RateFT24Lethal RateF
9103.000.01583.000.000
100.00087.000.0000.004124.001.9500.487
110.001117.000.3890.09783.000.0000.487
10050.154110.000.0780.05086.000.0000.000
10060.398120.000.7760.213123.001.5490.387
1007#NUM!0.000.000#NUM!0.000.000#NUM!#NUM!
1008TC2T23T24
1009116.64121.77119.01
1011
101355.5457.9956.67
1014
101526.4527.6126.99
Calc
 
Last edited:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
81,674
Office Version
  1. 365
Platform
  1. Windows
Untested, but try
Code:
Sub CommandButton1_Click()
With Columns(77)
   On Error Resume Next
   .SpecialCells(xlFormulas, xlLogical).EntireRow.Delete
   .SpecialCells(xlFormulas, xlErrors).EntireRow.Delete
   On Error GoTo 0
End With
End Sub
This will delete any row with a formula error
 
Upvote 0

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
81,674
Office Version
  1. 365
Platform
  1. Windows
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,186,878
Messages
5,960,383
Members
438,472
Latest member
Nate J

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
Top