Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code for Deleting rows by verification
Alright i have a list of variables like this
desired output after vba: a 1 6 a 1 6 b 2 2 c 3 1 c 3 1 d 4 8 Is there a way to alter the row deletion code to search multipl columns for the number one and if the row doesn't have a 1 then i will be deleted from the sheet. Thanks Eric Hoffma -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code for Deleting rows by verification
chart suppose to look like this:
a 1 6 b 2 2 c 3 1 d 4 8 desired output after vba: a 1 6 c 3 -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code for Deleting rows by verification
Try this
This will check each whole row for the value 1 Sub Example1() Dim Firstrow As Long Dim Lastrow As Long Dim Lrow As Long Dim CalcMode As Long With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False End With Firstrow = ActiveSheet.UsedRange.Cells(1).Row Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1 With ActiveSheet .DisplayPageBreaks = False For Lrow = Lastrow To Firstrow Step -1 If Application.WorksheetFunction.CountIf(.Rows(Lrow), "1") = 0 _ Then .Rows(Lrow).Delete Next End With With Application .ScreenUpdating = True .Calculation = CalcMode End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "hoffman3 " wrote in message ... Alright i have a list of variables like this desired output after vba: a 1 6 a 1 6 b 2 2 c 3 1 c 3 1 d 4 8 Is there a way to alter the row deletion code to search multiple columns for the number one and if the row doesn't have a 1 then it will be deleted from the sheet. Thanks Eric Hoffman --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code for Deleting rows by verification
The code in the last reply just seemed to freeze up excel, i waited fo
5 minutes then finally just restarted it. Thanks for the time though. Eric Hoffma -- Message posted from http://www.ExcelForum.com |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code for Deleting rows by verification
How many rows with Data you have?
If you use Ctrl End in what row are you. Look here if it is below your last row with data http://www.contextures.com/xlfaqApp.html#Unused -- Regards Ron de Bruin http://www.rondebruin.nl "hoffman3 " wrote in message ... The code in the last reply just seemed to freeze up excel, i waited for 5 minutes then finally just restarted it. Thanks for the time though. Eric Hoffman --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting rows in two columns with a code in visual basic | Excel Discussion (Misc queries) | |||
Ideal Code deleting rows/based on bold text | Excel Programming | |||
Deleting code in a file with code.. | Excel Programming | |||
visual basic macro code for deleting referenced rows | Excel Programming | |||
visual basic macro code for deleting referenced rows | Excel Programming |