0

我有一列数据正在尝试搜索某些字符串。找到字符串后,我想向该单元格添加一个新字符串。

Sub Scan()




Salesforce = "Fail - Incorrect % in Draft"
Calculation = "Fail - Incorrect Calculation "
Certification = "Fail - Missing Certification"
Documentation = "Fail - Missing Documentation"
Range(AD2).Select

   Do
     If InStr(1, "salesforce", "AMI", vbTextCompare) Then
        ActiveCell.Select.Value = Salesforce & ActiveCell.Value

     ElseIf InStr(1, "Inclusion", "non-taxable", vbTextCompare) Then
         ActiveCell.Select.Value = Calculation & ActiveCell.Value

     ElseIf InStr(1, "Missing", "ISAF", vbTextCompare) Then
        ActiveCell.Select.Value = Certification & ActiveCell.Value

     ElseIf InStr(1, "Documentation", "support", vbTextCompare) Then
        ActiveCell.Select.Value = Documentation & ActiveCell.Value

     End If

    Loop Until IsEmpty(ActiveCell) And IsEmpty(ActiveCell.Offset(1, 0))


Var = CellLoop()


End Sub

这是我的 CellLoop 遍历行的代码。

Public Function CellLoop()

Dim c As Range
Dim rng As Range

Set rng = Selection

cnt = 1

For Each c In rng
    c = cnt
    cnt = cnt + 1
Next

End Function
4

0 回答 0