Macro question

Y

ynissel

I cant figure out the sytax for a macro to delete rows that contain an error
in it. Basically I have a spread sheet with links and formulas and I need my
macro to delete any rows that the formula in column g is an error.
Thanks,
Yosef
 
S

ShaneDevenshire

Here is the general idea:

Sub DeleteRows()
Selection.SpecialCells(xlCellTypeFormulas, 16).Select
Selection.EntireRow.Delete
End Sub
 
S

ShaneDevenshire

Hi,

Sorry I missed the part about column G.

Sub DeleteRows()
[G1:G65536].SpecialCells(xlCellTypeFormulas, 16).EntireRow.Delete
End Sub

Will do it.
 
Y

ynissel

One more along the same lines.
How do I have the marco delete rows if the O column = a certain cell.
For instance my O column has a bunch of colors
Cell N1 list one color (red) and I want the macro to delete the rows that
contain the color from N1 in column "O".
Thanks,
Yosef

ShaneDevenshire said:
Hi,

Sorry I missed the part about column G.

Sub DeleteRows()
[G1:G65536].SpecialCells(xlCellTypeFormulas, 16).EntireRow.Delete
End Sub

Will do it.
--
Cheers,
Shane Devenshire


ynissel said:
Thanks - How does it know to check column G?
Yosef
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top