Delete a row

K

kevcar40

Hi
I am want to delete a row of information depending on the value of a
cell

If cell in column CN is equal to Saturday or sundayi want to delete
that row off data
i am trying to use the code below

ThisWorkbook.Worksheets("Working").Select
Set rng = Intersect(Columns(92), ActiveSheet.UsedRange)
rng.SpecialCells(xlBlanks).EntireRow.Delete
LastRow = ActiveSheet.UsedRange.Rows.Count
On Error GoTo 0
For RowNdx = LastRow To 1 Step -1
If Cells(RowNdx, "CN").Value = 0 Then
Rows(RowNdx).Delete
End If
Next RowNdx

How can i adapt this code to delete the required rows

thanks

kevin
 
B

Bob Phillips

ThisWorkbook.Worksheets("Working").Select
Set rng = Intersect(Columns(92), ActiveSheet.UsedRange)
rng.SpecialCells(xlBlanks).EntireRow.Delete
LastRow = ActiveSheet.UsedRange.Rows.Count
On Error GoTo 0
For RowNdx = LastRow To 1 Step -1
If Weekday(Cells(RowNdx, "CN").Value, 2) > 5 Then
Rows(RowNdx).Delete
End If
Next RowNdx


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
K

kevcar40

ThisWorkbook.Worksheets("Working").Select
Set rng = Intersect(Columns(92), ActiveSheet.UsedRange)
rng.SpecialCells(xlBlanks).EntireRow.Delete
LastRow = ActiveSheet.UsedRange.Rows.Count
On Error GoTo 0
For RowNdx = LastRow To 1 Step -1
If Weekday(Cells(RowNdx, "CN").Value, 2) > 5 Then
Rows(RowNdx).Delete
End If
Next RowNdx

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)









- Show quoted text -

Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top