+ Reply to Thread
Results 1 to 7 of 7

Clearing all cells with form results when file is opened

  1. #1
    Registered User
    Join Date
    07-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    13

    Clearing all cells with form results when file is opened

    Is there a way to clear all form results when a file is opened?

    I have 3 command buttons on a main page that spits out the results of the forms when they are completed. What I am looking to do it, have the results cleared out each time the file is opened.

    Is that possible, or is there a better way to do it?

    I can also add a Clear (command button) to the main page that they can hit to get started. I just cant figure out how to get it to clear the cells that display the results and provide a message of some sort in the cell like (please click the Calculate Reference Tier button to get started)

  2. #2
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Clearing all cells with form results when file is opened

    Hi
    Exactly which cells do you want cleared when the workbook is opened?
    Tony

  3. #3
    Registered User
    Join Date
    07-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Clearing all cells with form results when file is opened

    Ah yes, that would be helpful.

    In workbook.sheet1 I have 3 cells "location", "Type" and "Calculate"

    The first 2 cells are populated from userforms by clicking on the command buttons for each and the last cell is a command button that populates based on the values provided in the prior 2 cells.

    Does that help?

  4. #4
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Clearing all cells with form results when file is opened

    Hi
    Are these named ranges or column headers?
    Tony

  5. #5
    Registered User
    Join Date
    07-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Clearing all cells with form results when file is opened

    The are named see attached for example.
    Attached Images Attached Images

  6. #6
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Clearing all cells with form results when file is opened

    Hi
    First of all you need to ensure that the Workbook you intend to use is based on a new separate template as this macro will clear any ranges in any spreadsheet that have the same range names. Place this macro in a module and it will do what you need:

    Sub Auto_Open()
    '
    ' Macro1 Macro
    '
    Application.Goto Reference:="Location"
    Selection.ClearContents
    Application.Goto Reference:="Type"
    Selection.ClearContents
    Application.Goto Reference:="Calculate"
    Selection.ClearContents
    Range("A1").Select
    End Sub

    Good luck.
    Tony

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Clearing all cells with form results when file is opened

    perhaps simply
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Automatic close Help file (.chm) which was opened with Excel user form
    By leecs in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-24-2013, 06:02 AM
  2. How to set a Global Macros so that it gets opened every time an excel file is opened?
    By pericopericone in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-09-2013, 05:53 AM
  3. Splash screen in file opened by VBA hinders further processing of opened file.
    By Rod38 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2012, 09:53 AM
  4. Cells selected when file is opened
    By ssherman in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-25-2010, 03:54 PM
  5. [SOLVED] Need a psswd verification form to open when the file is opened
    By Linking to specific cells in pivot table in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-31-2005, 10:05 AM

Tags for this Thread

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