|
|
|
|
|
|
Excel
|
Clear Data Entry Cells
|
|
Ease of Use
|
Easy
|
Version tested with
|
2000, 2002
|
Submitted by:
|
Anne Troy
|
Description:
|
Clear the cells on which your formulas work.
|
Discussion:
|
You have a form that you use regularly. Perhaps you fill in data, then print it, and don't need to save a copy of the file. So, all you want to do is clear the data that you've entered each time. This method helps you do that.
|
Code:
|
instructions for use
|
Option Explicit
Sub ClearEntries()
On Error GoTo noName
Application.Goto Reference:="numbers"
Selection.ClearContents
Range("A1").Select
Exit Sub
noName:
MsgBox "The named range you are calling does not exist." & vbCr & _
"You need to name a range as 'numbers' before proceeding.", _
vbOKOnly + vbInformation, "Named range required"
End Sub
|
How to use:
|
- Select all the cells in which people enter their data.
- Choose Insert-Name-Define and type "numbers" without the quotes.
- Copy the code above.
- Hit Alt+F11 to open the Visual Basic Editor (VBE).
- On the left, choose your file, then hit Insert-Module from the menu.
- Paste the code into the code window that appears at right.
- Hit the save diskette and close the VBE.
|
Test the code:
|
- Hit Tools-Macro-Macros and double-click on ClearEntries.
|
Sample File:
|
ClearEntries.zip 7.29KB
|
Approved by mdmackillop
|
This entry has been viewed 156 times.
|
|