![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 05:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com