Why does VBA mess up
Why is it that when I try to run my code sometime it works other times
it does not. I have tried to run the whole thing or one section at a time. there have been times when I run maybe the first few lines and it doesn't work. Then I close excel re-open and still it won't work. Then I try it again and it works. This only started to happen when I went to adjust some of my code. All I added was strTextToFind = "Pre" <----------- I have this change arrText = Split(strTextToFind, ";") Set rngFind = Range("A1:A1000") On Error Resume Next For x = 0 To UBound(arrText) rngFind.Cells(1, 1).Activate Do Until Err.Number = 91 rngFind.Find(What:=arrText(x), after:=ActiveCell.Offset(1, 0), LookIn:=xlValues).Activate If Err.Number = 0 Then ActiveCell.EntireRow.Delete End If Loop Err.Clear Next x On Error GoTo 0 However, I already have three of the same exact lines other than the first line because it looks for that work then deletes that cell. I don't understand what is happening. Please help. |
All times are GMT +1. The time now is 10:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com