Excel 2007 Question

Posted on 2012-08-16
Last Modified: 2012-08-16
Hello Everyone,

I have attached an Excel File that I plan to use as an electronic workbook on the server.
I need for cells to clear out when it first opens on QTY.

How can this be done in code so as when eahc person opens the workbook the QTY Cell is cleared with no numbers in there.

Question by:jjc9809
    LVL 12

    Expert Comment

    Here you go:
    Private Sub Workbook_Open() 
         ' Change C6 to your desired cell
    End Sub 

    Open in new window

    LVL 8

    Accepted Solution

    Here's one that deletes all entries in QTY.

    Option Explicit
    Private Sub Workbook_Open()
        Dim wb As Workbook
        Dim ws As Worksheet
        Set wb = ThisWorkbook
        Set ws = wb.Worksheets("Product")
        ws.Range("A2:A" & ws.Range("A1000000").End(xlUp).Row).ClearContents
    End Sub

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
    This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
    This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
    This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now