Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Data table & VBA

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a data table that automatically opens with excel. What I am trying to do is when the user is finished entering thier data into the table and clicks on the close button it will automatically run that macro that I have already developed that sorts the data into the person's individual sheet and compiles that data into a group sheet.

  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You want to use the "BeforeClose" event: stick this on the "ThisWorkbook" object:

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    YourMacroName 'here
    End Sub


    Where "YourMacroName" is the name of your macro.

    HTH

  3. #3
    New Member
    Join Date
    Apr 2002
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Mark,
    I have been trying a few different things with the code you gave me, it seems that it only works when I close the file out and not when I close the data form....What could I be missing here?

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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