Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to delete line

Hi,

I want to write a macro that looks at a sheet, and any
line found with a '0' in a particular column gets deleted.

I.E If the macro finds a '0' in A5 then it deletes the
whole of the '5' row.


Any ideas



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Macro to delete line

Once you've found the range with the '0'
{range}.EntireRow.Delete
will delete the row. If you have done a select so the '0' is the
current position of the cursor, then ...
activecell.EntireRow.Delete

"Kevin Depree" wrote in message
...
Hi,

I want to write a macro that looks at a sheet, and any
line found with a '0' in a particular column gets deleted.

I.E If the macro finds a '0' in A5 then it deletes the
whole of the '5' row.


Any ideas





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Macro to delete line

Hi,

Try something like:

Sub DeleteRowsUsingAutoFilter()

Dim lLastRow As Long
Dim Rng As Range
Application.ScreenUpdating = False
Rows(1).Insert
Range("A1").Value = "Temp"
With ActiveSheet
.UsedRange
lLastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
Set Rng = Range("A1", Cells(lLastRow, "A"))
Rng.AutoFilter Field:=1, Criteria1:="0"
Rng.SpecialCells(xlCellTypeVisible).EntireRow.Dele te
.UsedRange
End With
End Sub

John Mansfield
pdbook.com

-----Original Message-----
Hi,

I want to write a macro that looks at a sheet, and any
line found with a '0' in a particular column gets deleted.

I.E If the macro finds a '0' in A5 then it deletes the
whole of the '5' row.


Any ideas



.

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 code to put series name next to individual line in line grap Otani Charts and Charting in Excel 3 February 23rd 10 07:24 PM
Challenge - Excel Line Feed Character CHR(10) - How to Delete and keep the text formatting without going ro single line in a cell ? No Name Excel Worksheet Functions 7 October 7th 09 11:10 AM
How do i delete a macro in Excel 2003 when delete isn't highlight Abel Excel Discussion (Misc queries) 2 September 13th 05 04:09 AM
Macro data selection line delete Frantic Excel-er Excel Discussion (Misc queries) 0 May 31st 05 11:46 PM
Macro to delete first line of 200+ files Bob Dobalina Excel Discussion (Misc queries) 2 May 26th 05 10:04 PM


All times are GMT +1. The time now is 07:44 AM.

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

About Us

"It's about Microsoft Excel"