ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Using New VBA code (https://www.excelbanter.com/excel-worksheet-functions/213181-using-new-vba-code.html)

kris

Using New VBA code
 
I am trying to set up a macro to delete rows if some of the columns in the
row do not contain data.

here is the code that I am using:

Sub DeleteBlankRows2()
'Deletes the entire row within the selection if _
some of the cells WITHIN THE SELECTION contain no data.

On Error Resume Next

Selection.EntireRow.SpecialCells(xlBlanks) . EntireRow.Delete

On Error GoTo 0

End Sub

The columns have pick lists build in some, but if I leave the pick list
blank I want it to delete the entire row. When I run the macro I get a
Syntax Error that says something is not set up right.

Can anyone help me?


Luke M

Using New VBA code
 
You have some extra spaces before the command 'entire row.delete'. Should be:

Selection.EntireRow.SpecialCells(xlBlanks).EntireR ow.Delete

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Kris" wrote:

I am trying to set up a macro to delete rows if some of the columns in the
row do not contain data.

here is the code that I am using:

Sub DeleteBlankRows2()
'Deletes the entire row within the selection if _
some of the cells WITHIN THE SELECTION contain no data.

On Error Resume Next

Selection.EntireRow.SpecialCells(xlBlanks) . EntireRow.Delete

On Error GoTo 0

End Sub

The columns have pick lists build in some, but if I leave the pick list
blank I want it to delete the entire row. When I run the macro I get a
Syntax Error that says something is not set up right.

Can anyone help me?


Ron de Bruin

Using New VBA code
 
Look out with this

See this page
http://www.rondebruin.nl/specialcells.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Luke M" wrote in message ...
You have some extra spaces before the command 'entire row.delete'. Should be:

Selection.EntireRow.SpecialCells(xlBlanks).EntireR ow.Delete

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Kris" wrote:

I am trying to set up a macro to delete rows if some of the columns in the
row do not contain data.

here is the code that I am using:

Sub DeleteBlankRows2()
'Deletes the entire row within the selection if _
some of the cells WITHIN THE SELECTION contain no data.

On Error Resume Next

Selection.EntireRow.SpecialCells(xlBlanks) . EntireRow.Delete

On Error GoTo 0

End Sub

The columns have pick lists build in some, but if I leave the pick list
blank I want it to delete the entire row. When I run the macro I get a
Syntax Error that says something is not set up right.

Can anyone help me?


Don Guillett

Using New VBA code
 
Why are you RE-posting the same question?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Kris" wrote in message
...
I am trying to set up a macro to delete rows if some of the columns in the
row do not contain data.

here is the code that I am using:

Sub DeleteBlankRows2()
'Deletes the entire row within the selection if _
some of the cells WITHIN THE SELECTION contain no data.

On Error Resume Next

Selection.EntireRow.SpecialCells(xlBlanks) . EntireRow.Delete

On Error GoTo 0

End Sub

The columns have pick lists build in some, but if I leave the pick list
blank I want it to delete the entire row. When I run the macro I get a
Syntax Error that says something is not set up right.

Can anyone help me?




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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com