View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Shane Devenshire[_2_] Shane Devenshire[_2_] is offline
external usenet poster
 
Posts: 3,346
Default 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