Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default How to Delete rows with blank or specific value in a Macro ?

I would like to know if there's a way, within a macro, to delete rows within
a specific range if the first cell in the row is either empty or has a
specific value, such as 'False'.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default How to Delete rows with blank or specific value in a Macro ?

This should do it:

Sub test()
Dim TargetRange As Range
Set TargetRange = Range("A10:D15") ' Change to suit desired range
TargetCol = TargetRange.Column
FirstRow = TargetRange.Row
LastRow = TargetRange.Rows.Count + FirstRow - 1
For r = LastRow To FirstRow Step -1
If Cells(r, TargetCol).Value = "" Or _
Cells(r, TargetCol).Value = "False" Then
Rows(r).Delete
End If
Next
End Sub
"Glenn" skrev i meddelelsen
...
I would like to know if there's a way, within a macro, to delete rows
within
a specific range if the first cell in the row is either empty or has a
specific value, such as 'False'.


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
Macro to delete specific rows in different worksheets [email protected] Excel Programming 5 March 19th 07 10:24 PM
Macro to delete rows containing specific data Slohcin New Users to Excel 2 December 20th 06 11:52 AM
Macro to delete specific rows Gert-Jan[_2_] Excel Programming 2 December 20th 06 09:29 AM
To Delete the specific rows when blank is found on column A ddiicc Excel Programming 3 August 5th 05 05:32 AM
Macro to delete specific rows Steve Excel Programming 12 October 1st 04 11:50 PM


All times are GMT +1. The time now is 10:39 AM.

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"