Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Message Box: Delete row x?
i have a macro designed to allow a user to delete a row in a protected
worksheet. In the message box, i'd like to prompt the user as follows: "Are you sure you want to delete row x?" with X being the row number of where the cursor is currently sitting. thanks in advance, tami |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Message Box: Delete row x?
Option Explicit
Sub testme() Dim resp As Long resp = MsgBox(Prompt:="Are you sure you want to delete row " & ActiveCell.Row, _ Buttons:=vbYesNo) If resp = vbYes Then 'unprotect the sheet ActiveCell.EntireRow.Delete 'protect the sheet End If End Sub Tami wrote: i have a macro designed to allow a user to delete a row in a protected worksheet. In the message box, i'd like to prompt the user as follows: "Are you sure you want to delete row x?" with X being the row number of where the cursor is currently sitting. thanks in advance, tami -- Dave Peterson |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Message Box: Delete row x?
perfect!
thanks much! tami "Dave Peterson" wrote: Option Explicit Sub testme() Dim resp As Long resp = MsgBox(Prompt:="Are you sure you want to delete row " & ActiveCell.Row, _ Buttons:=vbYesNo) If resp = vbYes Then 'unprotect the sheet ActiveCell.EntireRow.Delete 'protect the sheet End If End Sub Tami wrote: i have a macro designed to allow a user to delete a row in a protected worksheet. In the message box, i'd like to prompt the user as follows: "Are you sure you want to delete row x?" with X being the row number of where the cursor is currently sitting. thanks in advance, tami -- Dave Peterson |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Message Box: Delete row x?
Hi,
If you protect the sheet in code with a line like ActiveSheet.Protect Password:="x", userinterfaceonly:=True Then there is no need to unprotect and reprotect within the macro. You can run this as a standalone macro or incorporate it into a Workbook_Open routine. -- If this helps, please click the Yes button. Cheers, Shane Devenshire "Tami" wrote: perfect! thanks much! tami "Dave Peterson" wrote: Option Explicit Sub testme() Dim resp As Long resp = MsgBox(Prompt:="Are you sure you want to delete row " & ActiveCell.Row, _ Buttons:=vbYesNo) If resp = vbYes Then 'unprotect the sheet ActiveCell.EntireRow.Delete 'protect the sheet End If End Sub Tami wrote: i have a macro designed to allow a user to delete a row in a protected worksheet. In the message box, i'd like to prompt the user as follows: "Are you sure you want to delete row x?" with X being the row number of where the cursor is currently sitting. thanks in advance, tami -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
using VBA how can I delete a worksheet w/o the warning message pop | Excel Discussion (Misc queries) | |||
Confirm Delete Message Disable | New Users to Excel | |||
delete coumns - shift non-blank cells message | Excel Discussion (Misc queries) | |||
What is the VBA code to delete a sheet without warning message? | Excel Discussion (Misc queries) | |||
changing the message in an error message | Excel Worksheet Functions |