I have a loop in a macro that seems to have stopped working. This part of the macro, and the data I'm using to test the macro, have not changed since the last time I tested it, 2-3 weeks ago. All changes made to the macro take place after this part is complete. (I was trying to check something that comes later in the code.)
I have no idea what happened. I am on a different computer, but on the same network, using the same version of Windows and Excel. I have double checked the data, and the value searched for matches perfectly, including the trailing space.
Can someone explain why the code might not work and/or suggest an alternate loop that is more reliable?
I have no idea what happened. I am on a different computer, but on the same network, using the same version of Windows and Excel. I have double checked the data, and the value searched for matches perfectly, including the trailing space.
Can someone explain why the code might not work and/or suggest an alternate loop that is more reliable?
Code:
Sub JLI()
' Move to cell A5, check if text="Remit To: ". If so insert line before every "Remit To: " in the sheet
Range("A5").Select
If Range("A5").Value = "Remit To: " Then
Selection.End(xlDown).Select
Do Until ActiveCell.Row = 1
If ActiveCell.Value = "Remit To: " Then
ActiveCell.EntireRow.Insert shift:=xlDown 'Insert blank row.
ActiveCell.Value = "blank"
End If
ActiveCell.Offset(-1, 0).Select 'Move up one row.
Loop
End If
End Sub