Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA
Could some pls help me with the below macro.
Starting from row 5 to say 200 I want to delete the entire row if a cell in Col B is blank/empty. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA
When deleting rows, you should always work from the bottom up.
Dim RowNdx As Long For RowNdx = 200 To 5 Step -1 If Cells(RowNdx, "B").Value = "" Then Rows(RowNdx).Delete End If Next RowNdx -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com wrote in message oups.com... Could some pls help me with the below macro. Starting from row 5 to say 200 I want to delete the entire row if a cell in Col B is blank/empty. Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA
option explicit
sub testme01() dim iRow as long dim delRng as range with activesheet for irow = 5 to 200 if .cells(irow,"B").value = "" then if delrng is nothing then set delrng = .cells(Irow,"A") else set delrng = union(delrng,.cells(irow,"A")) end if end if next irow end with if delrng is nothing then 'do nothing else delrng.entirerow.delete end if end sub " wrote: Could some pls help me with the below macro. Starting from row 5 to say 200 I want to delete the entire row if a cell in Col B is blank/empty. Thanks -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA
Range("B5:B200").SpecialCells(xlCellTypeBlanks).En tireRow.Delete
" wrote: Could some pls help me with the below macro. Starting from row 5 to say 200 I want to delete the entire row if a cell in Col B is blank/empty. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|