当我运行此代码时,我反复收到错误1004
with activecell
.Formula = "=CONCATENATE(" & ActiveCell.Offset(0, -2).Address & "," _
& ":" & "," & ActiveCell.Offset(0, -1).Address & ")"
end with
有没有人知道问题出在哪里?
答案 0 :(得分:4)
你想要
"=CONCATENATE(" & ActiveCell.Offset(0, -2).Address & ","":""," & ActiveCell.Offset(0, -1).Address & ")"
因为您当前的公式评估为(选择了F4)
=CONCATENATE($D$4,:,$E$4)
错误是错误的。
尝试
Option Explicit
Public Sub test()
With ActiveCell
.Formula = "=CONCATENATE(" & .Offset(0, -2).Address & ","":""," & .Offset(0, -1).Address & ")"
End With
End Sub
具有评估为
的公式=CONCATENATE($D$4,":",$E$4)
这会在""
: