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
[TABLE="width: 500"]
<tbody>[TR]
[TD]Lot[/TD]
[TD]Date[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]9-Nov-2014[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]9-Nov-2014[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]10-Okt-2014[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]20-Okt-2014[/TD]
[/TR]
</tbody>[/TABLE]

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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
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,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

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