replace For..Next loop and use SpecialCells instead?

pwl2706

Board Regular
Joined
Mar 12, 2013
Messages
60
hi all,

is there a way to remove the For... Next loop in the below and do it with one step using SpecialCells

Code:
Sub clearCells()
Dim oCell As Range

Range("C1:C" & Range("A1").End(xlDown).Row).Formula = "=IF(OR(A:A=""+"",A:A=""-""),NA(),"""")"

ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormulas, xlErrors).EntireRow.Select

For Each oCell In Selection
    Range("A" & oCell.Row).Clear
Next

Range("A1").Select

End Sub

thanks for any ideas
Philip
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
I got it:

Code:
Range("A1").Worksheet.UsedRange.SpecialCells(xlCellTypeFormulas, xlErrors).Offset(0, -2).Clear
 
Upvote 0

Forum statistics

Threads
1,215,379
Messages
6,124,609
Members
449,174
Latest member
ExcelfromGermany

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