Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
FJ FJ is offline
external usenet poster
 
Posts: 90
Default Delete entire row if column B shows -

Hi, I'm trying to write a macro that will delete an entire row if the value
of the cell in column B of that row is 0. In this case, the number format is
set to display zeros as dashes. I'm not sure if that would make a difference
in the way the macro is written. Anyway, I've tried the following with no
success. Can anyone tell me where I'm going wrong?

Range("b:b").SpecialCells(xlCellTypeAllFormatCondi tions, 0).EntireRow.Delete

I'm very new to VBA so I might be totally offbase with this to begin with.

Thanks in advance for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Delete entire row if column B shows -

Take a look at F. David McRitchie's site...

http://www.mvps.org/dmcritchie/excel/delempty.htm



"FJ" wrote in message
...
Hi, I'm trying to write a macro that will delete an entire row if the
value
of the cell in column B of that row is 0. In this case, the number format
is
set to display zeros as dashes. I'm not sure if that would make a
difference
in the way the macro is written. Anyway, I've tried the following with no
success. Can anyone tell me where I'm going wrong?

Range("b:b").SpecialCells(xlCellTypeAllFormatCondi tions,
0).EntireRow.Delete

I'm very new to VBA so I might be totally offbase with this to begin with.

Thanks in advance for any help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
FJ FJ is offline
external usenet poster
 
Posts: 90
Default Delete entire row if column B shows -

Hi, Mark, thank you very much for the link. There is a lot of great
information on that site and I was able to find a macro that did what I
needed. Thanks again! :)



"Mark Ivey" wrote:

Take a look at F. David McRitchie's site...

http://www.mvps.org/dmcritchie/excel/delempty.htm



"FJ" wrote in message
...
Hi, I'm trying to write a macro that will delete an entire row if the
value
of the cell in column B of that row is 0. In this case, the number format
is
set to display zeros as dashes. I'm not sure if that would make a
difference
in the way the macro is written. Anyway, I've tried the following with no
success. Can anyone tell me where I'm going wrong?

Range("b:b").SpecialCells(xlCellTypeAllFormatCondi tions,
0).EntireRow.Delete

I'm very new to VBA so I might be totally offbase with this to begin with.

Thanks in advance for any help.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Delete entire row if column B shows -

Try this. Test to see if rows selectedthen change .select to .delete
Sub delzerorows()
lr = Cells(Rows.Count, "a").End(xlUp).Row
Range("A1:F" & lr).AutoFilter Field:=2, Criteria1:="0"
Range("A2:F" & lr).SpecialCells(xlCellTypeVisible).EntireRow.Sele ct
Range("a1:f" & lr).AutoFilter
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"FJ" wrote in message
...
Hi, I'm trying to write a macro that will delete an entire row if the
value
of the cell in column B of that row is 0. In this case, the number format
is
set to display zeros as dashes. I'm not sure if that would make a
difference
in the way the macro is written. Anyway, I've tried the following with no
success. Can anyone tell me where I'm going wrong?

Range("b:b").SpecialCells(xlCellTypeAllFormatCondi tions,
0).EntireRow.Delete

I'm very new to VBA so I might be totally offbase with this to begin with.

Thanks in advance for any help.


  #5   Report Post  
Posted to microsoft.public.excel.programming
FJ FJ is offline
external usenet poster
 
Posts: 90
Default Delete entire row if column B shows -

Hi, Don, thank you very much for that code. I tried it and and it worked
great. :)

Thanks again!



"Don Guillett" wrote:

Try this. Test to see if rows selectedthen change .select to .delete
Sub delzerorows()
lr = Cells(Rows.Count, "a").End(xlUp).Row
Range("A1:F" & lr).AutoFilter Field:=2, Criteria1:="0"
Range("A2:F" & lr).SpecialCells(xlCellTypeVisible).EntireRow.Sele ct
Range("a1:f" & lr).AutoFilter
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"FJ" wrote in message
...
Hi, I'm trying to write a macro that will delete an entire row if the
value
of the cell in column B of that row is 0. In this case, the number format
is
set to display zeros as dashes. I'm not sure if that would make a
difference
in the way the macro is written. Anyway, I've tried the following with no
success. Can anyone tell me where I'm going wrong?

Range("b:b").SpecialCells(xlCellTypeAllFormatCondi tions,
0).EntireRow.Delete

I'm very new to VBA so I might be totally offbase with this to begin with.

Thanks in advance for any help.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete entire page 2 so document shows as 1 page only Elinita New Users to Excel 1 November 22nd 09 06:35 PM
Need to delete last value in column but not delete entire row [email protected] Excel Programming 4 October 19th 06 05:26 PM
CANNOT DELETE AN ENTIRE COLUMN ibeetb Excel Discussion (Misc queries) 4 June 23rd 06 02:55 AM
Find Column heading and then Delete entire column Kobayashi[_58_] Excel Programming 4 October 17th 05 09:09 PM
Entire Column Delete ermeko Excel Programming 3 April 28th 05 02:17 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"