View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_3_] Dick Kusleika[_3_] is offline
external usenet poster
 
Posts: 599
Default Macro to delete record and validation problem

Bob

That macro is an event macro that goes in the sheet's class module. It is
triggered when cell B2 is changed. If you would rather have it activated
from a button, then put the code in a standard module, change the name and
remove the Private keyword, e.g. from this

Private Sub Worksheet_Change(ByVal Target As Range)

to this

Sub User_Dele()

Then you need to replace all the occurences of the Me keyword and replace
them with a reference to the sheet. For example, this

Set shDet = Me.Parent.Sheets("user details")

needs to be changed to

Set shDet = ThisWorkbook.Sheets("user details")

Me refers to the sheet and Parent refers to the Workbook, so replace those
keywords with ThisWorkbook to get to the proper sheet.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Bob" wrote in message
...

On the first one i insert the code into the macro; then when i want to
go add the macro to a button the macro doesnt show up??? help???


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to

creating financial statements