Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 123
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 123
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
using VBA how can I delete a worksheet w/o the warning message pop Jim K.[_2_] Excel Discussion (Misc queries) 2 July 1st 08 04:00 PM
Confirm Delete Message Disable RiosPapa New Users to Excel 2 October 7th 05 09:02 PM
delete coumns - shift non-blank cells message omb researcher Excel Discussion (Misc queries) 2 September 26th 05 11:07 PM
What is the VBA code to delete a sheet without warning message? [email protected] Excel Discussion (Misc queries) 2 August 9th 05 04:16 PM
changing the message in an error message The Villages DA Excel Worksheet Functions 2 February 18th 05 05:30 PM


All times are GMT +1. The time now is 02:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"