View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] john.mctigue@health.wa.gov.au is offline
external usenet poster
 
Posts: 6
Default Macro loop with messagebox

On Mar 6, 11:57*am, PVT wrote:
Hi- can you please help me fix the following macro. It "hangs" when
"no" is chosen at the messagebox. How do I make it go to the next cell
in the "if" statement?

Sub DeleteSearchTerm26()
Dim c As Range

With ActiveSheet.Range("A:A")
* * Do

* * * * Set c = .Find("by", LookIn:=xlValues, lookat:=xlPart, _
* * * * * * *MatchCase:=False)

* * * * If c Is Nothing Then Exit Do
* * * * c.Select

* * * * If MsgBox("Delete entire row?", vbYesNo) = vbYes Then
c.EntireRow.Delete Else ActiveCell.Offset
(0,1).Select

* * * * * * *Loop
End With

End Sub


Should that be Inputbox instead of Msgbox? (I've forgotten the little
Excel I knew so that may not be the case.)

Kind regards,
John