Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jun 2002
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Clear based on User Input (Excel 2000)

    Hi All -- and thanks for all the help yesterday ...
    (it seems every time I do something with this lounge's help -- I am asked to do something more!) <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>
    Anyways ...
    How can I automatically ask the user if he wants to clear his selections, and if he does, clear cells A16:A300, whenever the user performs a Save. Is this possible.

    Thanks all.

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Clear based on User Input (Excel 2000)

    You can trap thw Workbook before close event and pop up a message box that will give the option. The following example wll ask kif the selections should be cleared before saving and includes an option to cancel theh save.<pre>Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Action = MsgBox("Clear Selections before Saving ?", vbQuestion + vbYesNoCancel)
    Select Case Action
    Case vbYes
    Worksheets("Sheet1").Range("A16:A300").ClearConten ts
    Case vbCancel
    Cancel = True
    End Select
    End Sub</pre>

    That procedure must be placed in the Thisworkbook object's code module. Also note you may have to change the sheet name ("Sheet1") above.

    Andrew C

  3. #3
    Lounger
    Join Date
    Jun 2002
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear based on User Input (Excel 2000)

    Thanks Andrew

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •