Thread: VBA
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default 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