Clearing entered information

  • Thread starter Thread starter Ducatisto
  • Start date Start date
D

Ducatisto

Firstly hi all,

I am a complete noob when it comes to excel and am just starting t
enjoy the power it offers. I have created an excel file for work tha
needs daily information inputted to calculate manpower hours t
complete the daily tasks and at the end of the day needs to be cleare
of that particular days information and the next days inputted. Th
task itself is not too particularly time consuming but I would like t
know if there is way that with the aid of a "button" it would clear al
the relevant information instead of manually deleting it.

Duc
 
Ducatisto said:
Firstly hi all,

I am a complete noob when it comes to excel and am just starting to
enjoy the power it offers. I have created an excel file for work that
needs daily information inputted to calculate manpower hours to
complete the daily tasks and at the end of the day needs to be cleared
of that particular days information and the next days inputted. The
task itself is not too particularly time consuming but I would like to
know if there is way that with the aid of a "button" it would clear all
the relevant information instead of manually deleting it.

Duca


Hi Duca

You could record a macro, as follows:

Tools > Macro > Record New Macro > In Macro Name give it a name (no
spaces eg ClearData) > Click OK > now every key stroke / mouse click
you make will be recorded, so select the cells you want to clear data
from > right mouse click and click on clear contents > Tools > Macro >
Stop Recording
 
Hi, Duca,
Be careful when recording your keystrokes, as the recorder will record you
clearing (for example) A1:D20 - say you inserted a new row between rows 2 and
3 - your overall data range would be A1:D21, but your macro would only clear
down to row 20.

A better way is to give a range name to the range of cells you want to work
with, by highlighting the range and using Insert Name Define from the menu.

If you then subsequently insert or delete rows or columns within your named
range, the name will refer to the modified range. You can then use something
like

Sub ClearMyDataRange
Range("MyDataRange").clearcontents
end sub

where MyDataRange is the name you gave to the range.

To attach this to a button, add the "button" tool from the "Forms" category
and use it to draw buttons in your worksheet. When you draw the button, you
will be prompted to specify the macro you want the button to run.

You can change the macro that is attached to a button by right clicking it,
then clicking "Assign Macro" to choose the macro you want to attach.

If you need any help in where to create your macro, please come back!

Hope this helps

Pete
 
Why not do it the "simple" way, and create a template?

Just take your unused form and:
<File> <SaveAs>,
And expand the "Save As Type" box at the bottom,
Click on "Template(*.xlt)",
Make sure the filename is what you would want,
Then <Save>.

You now have your new, empty form ready for use by simply clicking on,
(Depending on version)
<File> <New> <General> tab,
Or
<File> <New> <GeneralTemplates> <General> tab,
And clicking on the filename of your form.

What opens is a *copy* of your form, with a "1" appended to the end of the
filename.
The original is "untouched", and still stored in the templates folder.

You can now use the "copy" and save it, or throw it away.
You can even open multiple "copies" at the same time, each with it's own
individual ID number appended to the filename.

When it comes time to revise or update the template, simply make your
changes to one of the copies, and do *almost* what you did the first time:
<File> <SaveAs>,
And expand the "Save As Type" box at the bottom,
Click on "Template(*.xlt)",
*Remove* the appended ID number, leaving the original filename intact,
Then <Save>.
Of course, you'll now be told that this file already exists, and be asked if
you wish to overwrite it, to which you answer "yes".
 
Paul said:
Hi Duca

You could record a macro, as follows:

Tools > Macro > Record New Macro > In Macro Name give it a name (n
spaces eg ClearData) > Click OK > now every key stroke / mouse clic
you make will be recorded, so select the cells you want to clear dat
from > right mouse click and click on clear contents > Tools > Macro
Stop Recording


Many thanks for all of your help. From all of your answers I was abl
to fulfill what I wanted and now I have a button on my sheet that th
users can use to delete all of the old information. I just lov
learning!

Duc
 
Back
Top