adding a formula to VBA code

James__S

Active Member
Joined
Jan 26, 2014
Messages
332
I have the following code which works plus a formula in cell range G5:G123....how do i add the the formula to the VBA code please

Formula =IF(F5<>"".F5< today () +3 )<today()+3)


Code:
Private Sub Workbook_Open()
For Each cell In Range("F5:F19")
If cell.Value < Date + 3 And cell.Value <> "" Then
cell.Interior.Color = 3
cell.Font.ColorIndex = 2
cell.Font.Bold = True
End If
Next
End Sub

<today(),"send reminder","")
<today()+3)
<today(),"send reminder","")
<today()+3)<today()+3)
<today()+3)

Also instead of having the code update when book opens could it have a Commandbutton so it can be updated anytime

Thanks</today()+3)
</today()+3)<today()+3)
</today(),"send></today()+3)
</today(),"send></today()+3)
 
Last edited:
In Design Mode, right click the CommandButton, choose View Code and paste the code into the procedure stub that Excel creates.
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,215,514
Messages
6,125,265
Members
449,219
Latest member
daynle

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