如果E列像“ total”一样,如何在Z列中插入text =“ here”?

我尝试

Qtde = 50 'lines

For iLinha = 30 To Qtde
    compara = celula Like "*" & SearchString
    if compara then
        Orçamento.Cells(iLinha, 26).Value = "here"
    end if
Next iLinha

最佳答案

您的代码的问题是

compara = celula Like "*" & SearchString

您尚未定义什么是celula

您的代码可以写成

Qtde = 50 'lines
SearchString = "Total"

For iLinha = 30 To Qtde
    If Orçamento.Cells(iLinha, 1) Like "*" & SearchString Then
        Orçamento.Cells(iLinha, 26).Value = "here"
    End If
Next iLinha

关于excel - 如何通过VBA在Excel中插入文本,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20571453/

10-12 00:37