vba 根据当前日期自动更改excel单元格值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27341621/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
automatically change excel cell value depending on current date
提问by Martin
I have a column of values infront of respective date of current month . The column cell are C1:C31 [which have some numbers in them] while infront of it is date column which show respective date from 1st Dec to 31st Dec [Lets say these dates are in Column D1 to D31]
我在当前月份的相应日期前面有一列值。列单元格是 C1:C31 [其中有一些数字] 而在它前面的是日期列,显示从 12 月 1 日到 12 月 31 日的相应日期[假设这些日期在 D1 到 D31 列中]
I want to display a cell value from C1 to C31 in another cell "A40" depending on current date
我想根据当前日期在另一个单元格“A40”中显示从 C1 到 C31 的单元格值
For example today is 7th december so the cell infront of it [D7] is "C7" which has a value "13589"
例如今天是 12 月 7 日,所以它前面的单元格 [D7] 是“C7”,其值为“13589”
Now i want the cell A40 to display this value [13589] as per todays date , when i open excel sheet tomorow [8th dec] this cell [A40] will update the respective value from C8 tomorow .
现在我希望单元格 A40 根据今天的日期显示此值 [13589],当我明天 [12 月 8 日] 打开 Excel 工作表时,此单元格 [A40] 将更新来自 C8 的相应值明天。
How to achieve this ?
如何实现这一目标?
回答by Sam
Sounds like you just need an index/match formula...
听起来你只需要一个索引/匹配公式......
=INDEX($C:$C,MATCH(TODAY(),$D:$D,0))