Hello Experts,
How do you improve upon this code to loop until a cell is empty and
include a message box for each change?
'set String (or Long) = "total operating expenses"
'so that Find: "total operating expenses" = the String
Cells.Find(What:="total operating expenses", After:=ActiveCell, LookIn:=
_
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns,
SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(-2, 0).Range("A1").Select
'Loop starts here. If cell is blank, then stop. If not, enter the set
String (being "Other Operating Expenses"
If cell = "" Then
ActiveCell.FormulaR1C1 = "Other Operating Expenses"
'Msgbox: [the old word content of this cell] will be replaced by [the
String]. vbYes to Replace and move up another cell. vbNo to not
replace and move up another cell.
ActiveCell.Offset(-1, 0).Range("A1").Select
'Stop moving up any further if cell is blank.
End If
'Loop ends here.
End Sub
Thanks in advance,
Ricky
*** Sent via Developersdex
http://www.developersdex.com ***