How can change data every 5 days?

ngocanh87

Board Regular
Joined
Mar 16, 2016
Messages
85
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hello all,

Data at M4,L4 change every 5 days: 1-5,6-10...,26-end

Day 01Feb, at E6=$M$4, E7=$L$4,
Day 06Feb, at F6=$M$4, E7=$L$4
...
Day 26Feb, at J6=$M$4, E7=$L$4

How can use vba or formula to change data of E6,F6..J6 follow M4,L4. Thank all

Book1
ABCDEFGHIJKLM
1 KẾT QUẢ SẢN LƯỢNG VÀ ĐƠN GIÁ 2023 14/02/2023
2VND => USDSUM WEIGHT
3 KẾT QUẢ KINH DOANH THÁNG 02 Unit / ĐVT:MT; USD 【確定計数】
4 Budget (Dự toán) Transit Goods (Hàng đi đường) 5日 (01 -05) 10日 (06 - 10) 15日 (11 - 15) 20日 (16 - 20) 25日 (21 - 25) 28日 (26 - 28) 2137280,4092029,712
5
6 Weight Shipment / Trọng lượng -2.0302.0302.0302.0302.0302.030
7 Amount / Thành tiền -2.137.2802.137.2802.137.2802.137.2802.137.2802.137.280
8 Price/ Đơn giá -1.0531.0531.0531.0531.0531.053
Sheet1
Cell Formulas
RangeFormula
J1J1=TODAY()
E6:J6E6=$M$4
E7:J7E7=$L$4
E8:J8E8=E7/E6
 
I just test and have problem, if today 16 feb data at M4 will change and the data of the old date also changes. How can I keep old date not change (keep as value)
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I think can use this code, thank you so much.

Private Sub Workbook_Open()

Dim R As Range

Set R = Range("i:i")

If Format(Now, "DD/MM/YYYY") > Format(Range("i1"), "DD/MM/YYYY") Then
R = R.Value
End If

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,120
Members
453,021
Latest member
Justyna P

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