我无法理解如何制作宏。
我尝试搜索列,并在每个单元格中检查文本"TODAY()"
,并将其替换为"TODAY() + B2"
,其中B2为某些天数。
我一直在搜索,我觉得我已经接近但我仍然遇到麻烦。
Sub findrep()
Dim Findtext As String
Dim Replacetext As String
Findtext = "TODAY()"
Replacetext = SUM(TODAY(),"Sheets("Sheet1").Range("B2").Value")
Columns("A").Replace what:=Findtext, replacement:=Replacetext, lookat:=xlPart, MatchCase:=False
End Sub
我希望将来某个时间在单元格中显示日期,具体取决于单元格B2中的天数。 VBA必须能够在单元格中搜索公式,因为公式中不仅仅有"TODAY()"
。
提前致谢。
答案 0 :(得分:5)
尝试更改此行
Replacetext = SUM(TODAY(),"Sheets("Sheet1").Range("B2").Value")
到
Replacetext = "TODAY()+Sheet1!B2"