0

I have a column of data that I'm trying to search through for certain strings. After I find the string I want to add a new string to that cell.

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

Here is the code for my CellLoop to iterate through rows.

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
BigBen
  • 46,229
  • 7
  • 24
  • 40
  • 2
    None of your `InStr` lines will ever be true... you're just comparing hard-coded strings, not the value of the cells you're presumably trying to loop over. – BigBen Apr 24 '20 at 14:56
  • 1
    You have an infinite loop it looks like too, you never change the active cell. – Warcupine Apr 24 '20 at 14:58

0 Answers0