Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, Here is my attacthment. Can someone show me how if there is a way that I can do the following macro? Select every row that DOES NOT have either 12347 or 12360 in column G and delete those rows? My orginal total is 14. When the macro is done I should have 7. +-------------------------------------------------------------------+ |Filename: test.zip | |Download: http://www.excelforum.com/attachment.php?postid=4099 | +-------------------------------------------------------------------+ -- jcc31 ------------------------------------------------------------------------ jcc31's Profile: http://www.excelforum.com/member.php...o&userid=24692 View this thread: http://www.excelforum.com/showthread...hreadid=490827 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I didn't open your attachment (I don't know whether it contains
nefarious code), but the follow code should do essentially what you want. Dim RowNdx As Long Dim LastRow As Long LastRow = Cells(Rows.Count, "G").End(xlUp).Row For RowNdx = LastRow To 1 Step -1 If Not (Cells(RowNdx, "G").Value = 12347 Or _ Cells(RowNdx, "G").Value = 12360) Then Rows(RowNdx).Delete End If Next RowNdx -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "jcc31" wrote in message ... Hi, Here is my attacthment. Can someone show me how if there is a way that I can do the following macro? Select every row that DOES NOT have either 12347 or 12360 in column G and delete those rows? My orginal total is 14. When the macro is done I should have 7. +-------------------------------------------------------------------+ |Filename: test.zip | |Download: http://www.excelforum.com/attachment.php?postid=4099 | +-------------------------------------------------------------------+ -- jcc31 ------------------------------------------------------------------------ jcc31's Profile: http://www.excelforum.com/member.php...o&userid=24692 View this thread: http://www.excelforum.com/showthread...hreadid=490827 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() That worked perfect. Thanks a million -- jcc31 ------------------------------------------------------------------------ jcc31's Profile: http://www.excelforum.com/member.php...o&userid=24692 View this thread: http://www.excelforum.com/showthread...hreadid=490827 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() That worked perfect. OH just one small addition. I would like the keep the first row. The header row that has the name zip. -- jcc31 ------------------------------------------------------------------------ jcc31's Profile: http://www.excelforum.com/member.php...o&userid=24692 View this thread: http://www.excelforum.com/showthread...hreadid=490827 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Then use
For RowNdx = LastRow To 2 Step -1 -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "jcc31" wrote in message ... That worked perfect. OH just one small addition. I would like the keep the first row. The header row that has the name zip. -- jcc31 ------------------------------------------------------------------------ jcc31's Profile: http://www.excelforum.com/member.php...o&userid=24692 View this thread: http://www.excelforum.com/showthread...hreadid=490827 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hpw do I delete multiple empty rows found between filled rows? | Excel Worksheet Functions | |||
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows | Excel Worksheet Functions | |||
Delete rows with numeric values, leave rows with text | Excel Programming | |||
How to delete rows when List toolbar's "delete" isnt highlighted? | Excel Worksheet Functions | |||
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below | Excel Programming |