View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default re : Finding the datas and deleting datas which are not found.

To delete all except one:
dayexcept = 5
Rows("1:" & dayexcept - 1).EntireRow.Delete
Rows(dayexcept + 1 & ":31").EntireRow.Delete

If you don't use a variable for the day number, you can write simply to
delete all rows except row 5
Row("1:4").EntireRow.Delete
Row("6:31").EntireRow.Delete

Regards,
Stefi


ddiicc ezt *rta:

Hi Stefi,
So If I want only day number 5 in the column (A:A) to stay and the rest
from 1 to 31 except for 5 to be deleted,

I add accordingly like this???

Row(5+1 & ":31:).EntireRow.Delete???


"Stefi" wrote:

Simply apply in your code

Rows(dayfrom +1 & ":31").EntireRow.Delete

where dayfrom is 5 in your example.

Regards,
Stefi

ddiicc ezt *rta:

Hi,

I have a column (AZ:AZ) header name "DAY", this column consist of 1 to 31
which the number stand for the day of the month. Let say, i would like to
day number 5 and delete the rest of the rows which does not contain the day
number 5,
how do I go abt i writing the code for this?? Possible??

Thanks
Tony