Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Pausing a macro
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Pausing a macro
Use the UserForm and RefEdit ****rol
"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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Pausing Macro | New Users to Excel | |||
Is there a way of pausing a macro | Excel Discussion (Misc queries) | |||
Pausing a Macro | Excel Discussion (Misc queries) | |||
Spreadsheet pausing,calculating cells,up2 100%,each input,why? | Excel Discussion (Misc queries) |