View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default How to delete rows of referenced cells...

Here is one possibility.
sub DeleteRows()
Dim cnt as Long
cnt = application.CountA(worksheets("Li").Range("A1:A10" ))
if cnt < 10 then
with worksheets("Looks_Like")
set rng = .Range(.Cells(cnt + 1,1),"A10").entireRow.Delete
end With
end sub

the above assumes the filled cells will be contiguous.

The next does not assume this:

sub ABC()
Dim rw as Long, i as Long
rw = 10
for i = 10 to 1 step -1
if isempty(worksheets("LI").Cells(i,1)) then
worksheets("Looks_Like").rows(i).Delete
end if
Next
End sub


--
Regards,
Tom Ogilvy

" wrote:

HI

(microsoft.public.excel.programming)

I am working on a excel sheet that works as per below pattern.

I have two sheets namely LI and Looks_Like.

I have 10 cells in Looks_llike sheet that are referenced to 10 cells
from LI sheet. Which means on Populating the cell A1 in LI sheet
cell A1 in Looks_like sheet gets populated with the same value.

now my question is, Now if i have only 5 cells populated in LI sheet
and the other 5 are empty, how do i delete the rows in which the
blank cells of Look_like sheet are present that are referenced to
these empty
cells in LI.

Can it be done using VB code If yes... I will be gr8ful if you can
help mew with the code.