+ Reply to Thread
Results 1 to 5 of 5

BeforeSave event

  1. #1
    Carl Bowman
    Guest

    BeforeSave event

    I am trying to build a macro that will automatically clear the contents of a
    certain cell just before the workbook is saved. I tried entering is as
    follows but it did not work:
    Sub Workbook_BeforeSave()
    Sheets("Instructions").Select
    Range("E5").Select
    Selection.ClearContents
    End Sub
    Thanks


  2. #2
    R D S
    Guest

    Re: BeforeSave event

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    Boolean)
    Sheets("Instructions").Select
    Range("E5").Select
    Selection.ClearContents

    End Sub


    "Carl Bowman" <CarlBowman@discussions.microsoft.com> wrote in message
    news:1A4A2455-5CC8-4248-A4B2-D681C1B555AA@microsoft.com...
    > I am trying to build a macro that will automatically clear the contents of

    a
    > certain cell just before the workbook is saved. I tried entering is as
    > follows but it did not work:
    > Sub Workbook_BeforeSave()
    > Sheets("Instructions").Select
    > Range("E5").Select
    > Selection.ClearContents
    > End Sub
    > Thanks
    >




  3. #3
    R.VENKATARAMAN
    Guest

    Re: BeforeSave event

    where did you park this sub. it should be parked after
    clicking<thisworkbook>
    click the excel icon before the menu <file> and click view code. in the
    resuting <thisworkbook(codee)> sheet click on the left hand side arrow and
    click <workbook> there you park thesub.
    if you have already done this then there is some other problem.

    by the by has the workbook already been saved once.


    Carl Bowman <CarlBowman@discussions.microsoft.com> wrote in message
    news:1A4A2455-5CC8-4248-A4B2-D681C1B555AA@microsoft.com...
    > I am trying to build a macro that will automatically clear the contents of

    a
    > certain cell just before the workbook is saved. I tried entering is as
    > follows but it did not work:
    > Sub Workbook_BeforeSave()
    > Sheets("Instructions").Select
    > Range("E5").Select
    > Selection.ClearContents
    > End Sub
    > Thanks
    >




  4. #4
    R.VENKATARAMAN
    Guest

    Re: BeforeSave event

    sorry ;i missed one point the sub heading is

    Private Sub Workbook_BeforeClose(Cancel As Boolean)

    End Sub
    after clicking workbook goto right side click <before closse> then write
    your code statements.

    mine is excel 2000
    Carl Bowman <CarlBowman@discussions.microsoft.com> wrote in message
    news:1A4A2455-5CC8-4248-A4B2-D681C1B555AA@microsoft.com...
    > I am trying to build a macro that will automatically clear the contents of

    a
    > certain cell just before the workbook is saved. I tried entering is as
    > follows but it did not work:
    > Sub Workbook_BeforeSave()
    > Sheets("Instructions").Select
    > Range("E5").Select
    > Selection.ClearContents
    > End Sub
    > Thanks
    >




  5. #5
    Ken Wright
    Guest

    Re: BeforeSave event

    In the ThisWorkbook module

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    Boolean)
    Sheets("Instructions").Range("E5").ClearContents
    End Sub

    --
    Regards
    Ken....................... Microsoft MVP - Excel
    Sys Spec - Win XP Pro / XL 97/00/02/03

    ----------------------------------------------------------------------------
    It's easier to beg forgiveness than ask permission :-)
    ----------------------------------------------------------------------------

    "Carl Bowman" <CarlBowman@discussions.microsoft.com> wrote in message
    news:1A4A2455-5CC8-4248-A4B2-D681C1B555AA@microsoft.com...
    > I am trying to build a macro that will automatically clear the contents of

    a
    > certain cell just before the workbook is saved. I tried entering is as
    > follows but it did not work:
    > Sub Workbook_BeforeSave()
    > Sheets("Instructions").Select
    > Range("E5").Select
    > Selection.ClearContents
    > End Sub
    > Thanks
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1