Thread: Pausing a macro
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
JMay JMay is offline
external usenet poster
 
Posts: 468
Default Pausing a macro

The below code CLEARS THE CELL CONTENT VERSUS DELETING **Watch out**
Paste this into a standard module:

Sub Foo()
Dim celaddress As String
res = MsgBox("Do you wish to delete a row?", vbYesNo)
If res = vbNo Then Exit Sub
celaddress = Application.InputBox("Enter Cell address of the row to Delete",
Type:=2)
Application.Goto Reference:=Worksheets("Sheet1").Range(celaddress)
If ActiveCell.Column 1 Then
MsgBox "You must select a cell in Column A"
Exit Sub
End If
If ActiveCell.Address = "$A$5" Then
MsgBox "You cannot select cell A5"
Exit Sub
End If
ActiveCell.Offset(0, 1).Resize(1, 9).ClearContents '<< Clears Contents
Versus Deleting !!
End Sub

Write back, if problems encountered..

Jim May


"Alex.W" wrote:

I am trying to develop a macro that deletes a row of data after pausing for
input.

I need a message that asks if they want to delete. If no, quit. If yes,
pause and ask for the cell at the start of the row to be selected.

Once selected, how is the macro re-activated?

If any column other than "A" is selected I need an error message.
If cell "A5" is selected I also need an error message.

I then need the macro to select the 9 cells to the right (in the same row)
of the one selected. This range is then deleted.

Alex.W