View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JLatham JLatham is offline
external usenet poster
 
Posts: 2,203
Default Loop until cell is empty

I think! this is what you are looking for:

If MsgBox(" your message ", vbYesNo, "Title") = vbYes then
'your actions if user chooses YES here
Else
'your actions if user chooses NO here
End If

If you just need to do something based on = vbYes, then you can eliminate
the Else section. Note that because we're treating MsgBox as a function, the
parameters have to be enclosed in () as shown above.

"Ricky Pang" wrote:

Thanks for the Do While...Loop help. Now I'm just missing the msgbox
whether or not to allow change. The part that I need help on is
indicated within this code.

'set String (or Long) = "total operating expenses"
'This is so that it's replaceable for another search word
'in the future
'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
Do While ActiveCell < Empty
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
Loop

Thanks again Wend,
Ricky

*** Sent via Developersdex http://www.developersdex.com ***