Reminder Date VBA Excel

galihsaputra

New Member
Joined
Nov 6, 2014
Messages
3
Hello Master,
I am newbie and starting new new create macro excel. I have problem in my VBA in excel, this is my sheet excel
LotDate
159-Nov-2014
159-Nov-2014
210-Okt-2014
520-Okt-2014

<tbody>
</tbody>

And this my code vba
Sub reminder()
For Each cell In Range("B7:B1994")

If cell.Value = Date + 3 Then
Cells(3, 2).Interior.ColorIndex = 4
Cells(3, 2).Font.ColorIndex = 0
Range("B3").Value = cell.Value


ElseIf cell.Value < Date + 3 Or cell.Value > Date + 3 Then
Cells(3, 2).Interior.ColorIndex = 0
Cells(3, 2).Font.ColorIndex = 0
Range("B3").Value = ""

End If

Next

On Error Resume Next
End Sub

when i click command button , I want show Date Today=Date+3 from coloum Date
Actually, it almost success but if I marking "ElseIF", but if i open marking "ElseIF"
this will looping as many total of coloum
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi and welcome to the MrExcel Message Board.

I think you are looking for something like this:

Code:
Sub reminder()

    With Range("B3")
    
        .Interior.ColorIndex = 0
        .Font.ColorIndex = 0
        .Value = ""
    
        For Each cell In Range("B7:B1994")
            If cell.Value = Date + 3 Then
                .Interior.ColorIndex = 4
                .Font.ColorIndex = 0
                .Value = cell.Value
                Exit For
            End If
        Next
        
    End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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