Change >= (later than day of or day of) to day after or day of

VBAProIWish

Well-known Member
Joined
Jul 6, 2009
Messages
1,027
Office Version
  1. 365
Platform
  1. Windows
Hello All,

Can I change the code in red and bold below to say this instead? (going to use laymen's terms)...

Code:
If Cells(i,19) "day after" OR "=" enddate Then
 
Quotes were used only for illustration purposes



Code:
Sub aaa_test_macro_01()
   Dim enddate As Date
   Dim i As Long
 
    enddate = Format(Sheets("Date Shipped").Range("z3"), "mm/dd/yy")
 
 
 
[B][SIZE=4][COLOR=red]    If Cells(i, 19) >= enddate Then[/COLOR][/SIZE][/B]
 
 
 
            Cells(i, 3).EntireRow.Delete
        End If
    Next i
 
End Sub


I really hope this can be done, it'll be a whole lot of work if I can't.


Thanks to anyone that can help me one this one :biggrin:
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Shouldn't be a problem. And as long as z3 is a date then you don't need to worry about formatting it in a particular way. Simply:

If Cells(i, 19).Value >= enddate then


Also, if you're deleting rows then you'll run into a problem with a basic For...Next loop. I.e. if i = 4 and you delete the row then do Next i, you won't ever evaluate what was in row 5 before the delete.

lastRow = Range('something').End(xlUp).Row
i = 1
For r = 1 To lastRow
If Cells(i,column).Value >= enddate Then
"deleterow"
Else
i = i + 1
End If
Next r
 
Upvote 0

Forum statistics

Threads
1,224,592
Messages
6,179,789
Members
452,942
Latest member
VijayNewtoExcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top