需要帮助

时间:2016-03-14 09:22:22

标签: excel vba excel-vba

我知道有关于这个主题的帖子,我希望你可以指导我完成这个。我很感激。

我在代码中的问题是范围(" AA"& n)=" = CONCATENATE("" S / N"", celctr4,""不在合同上。终止"",celctr3,""。"")"。它给了我一个错误。

代码:

Dim celctr3, celctr4 As String
dim n

n = 2
celctr3 = Range("V" & n).Value
celctr4 = Range("O" & n).Value
Do Until n = celctr2
    If celctr3 = "" Then
          n = n + 1
    Else
        Range("AA" & n & ":" & "AC" & n).Select
        Selection.ClearContents
        Range("AA" & n) = "=CONCATENATE(""S/N"", celctr4,""  is not on contract. Terminated "" , celctr3 , ""."") "
        Application.Calculate
        n = n + 1
    End If
Loop

感谢您的帮助。

1 个答案:

答案 0 :(得分:-1)

替换此行

Range("AA" & n) = "=CONCATENATE(""S/N"", celctr4,""  is not on contract. Terminated "" , celctr3 , ""."") "

使用

Range("AA" & n) = "=CONCATENATE(" & """S/N""" & "," & """" & celctr4 & """" _
        & "," & """  is not on contract. Terminated """ & "," & """" _
        & celctr3 & """" & "," & """.""" & ")"