Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Need Excel VBA Help with deleting rows

  Asked By: Ryan    Date: Sep 13    Category: MS Office    Views: 1178
  

I'm looking for some help:

I need a VBA code to delete all rows that do not contain a date
(01/01/2007) in Colum K.

I'm new at this and any help will be greatly apprciated.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Dion Jones     Answered On: Sep 13

that specific date or any date... if its any date then you can loop through
each row and check to see if its a valid date...

sub deleteifnotdate()
dim irow as integer
dim x as integer

irow = range("A65535").end(xlup).row

for x = irow to 1
if not isdate(range("K" & x).value) then
row(x).delete
end if
x = x-1
next x

end sub

should do the trick..

Note: air code  not tested but should work

 
Didn't find what you were looking for? Find more on Need Excel VBA Help with deleting rows Or get search suggestion and latest updates.




Tagged: