0
Dim dflrow As Integer

    ActiveWorkbook.Sheets("ElecTM").Range("I1048576").Select

    dflrow = Selection.End(xlUp).Row

'        ActiveWorkbook.Sheets("ElecTM").Range("AG" & dflrow & ":" & "AJ" & dflrow).Select

    ActiveWorkbook.Sheets("ElecTM").Range("AG6").Formula = "=CONCATENATE(Year(I6),"w",WeekNum(I6))"

    Selection.FillDown

在这里,我收到一条错误消息,指出第五行的语法错误。我试过'.value'而不是'.Formula'。但这没有帮助。

4

2 回答 2

0

您在中缺少双引号"w"

ActiveWorkbook.Sheets("ElecTM").Range("AG6").Formula = _
"=CONCATENATE(Year(I6),""w"",WeekNum(I6))"

如果在之间使用,您必须"额外填充"""

编辑:如有疑问,请录制宏;)

于 2013-09-30T10:37:19.077 回答
0

w 应该是双引号

ActiveWorkbook.Sheets("ElecTM").Range("AG6").Formula = "=CONCATENATE(Year(I6),""w"",WeekNum(I6))"

于 2013-09-30T10:37:26.017 回答