One click date + predefined text input.

J

James.T

I would like to create a button on my toolbar that once clicked inputs the
current date and 2 words.

Example:
With a cell JUST selected (not in typing/edit mode) you click this button
and it automaticlly enters typing/edit mode (f2) then goes to the next line
(alt + enter) and inputs the current date =TODAY() with a space and 2 words
"no change". All without clearing the current contents of the cell. There may
be multiple lines of text already.

Any help would be appreciated. This would shave coniderable time off my
daily Excel usage.
 
T

Tom Hutchins

This macro does what you want for a single cell (the active cell):

Sub AddDateAndComment()
ActiveCell.Value = ActiveCell.Value & vbLf & _
Format(Now(), "MM/DD/YY") & " no change"
End Sub

Here is a version that lets you select multiple cells. The current date &
"no change" comment will be added to every cell in the selection:

Sub AddDateAndComment()
Dim Rng As Range
For Each Rng In Selection
Rng.Value = Rng.Value & vbLf & _
Format(Now(), "MM/DD/YY") & " no change"
Next
End Sub

Excel's Help has instructions on how to add a custom button to a toolbar (or
a button on a worksheet), and to attach it to a macro. If you are new to
macros, this link to Jon Peltier's site may be helpful:
http://peltiertech.com/WordPress/2008/03/09/how-to-use-someone-elses-macro/

Hope this helps,

Hutch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top