ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   entering keystroke commands in a formula (https://www.excelbanter.com/excel-programming/273986-re-entering-keystroke-commands-formula.html)

Tom Ogilvy

entering keystroke commands in a formula
 
right click on the sheet tab and select view code.

Put in code like this:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Count 1 Then Exit Sub
If Target.Column = 3 Then
If Not IsEmpty(Target.Value) Then
Target.Offset(0, -1).Value = Date
Target.Offset(0, -1).NumberFormat = "mm/dd/yyyy"
Else
Target.Offset(0, -1).ClearContents
End If
End If
End Sub

You must manually enter those keystrokes to get the data - you can't put
them in a formula - the above code will put in a date in the same row in
column B when a value is entered in column C. If you clear the value in C,
it will clear the date in B.

--
Regards,
Tom Ogilvy
RandyB wrote in message
...
I would like to enter keystrokes in a formula, so that
when one cell is filled with a value, an adjoining cell
will automatically have a date filled in it. thanks to an
earlier newsgroup message, I saw that three keystrokes
CTRL+; provide a date in the selected cell. The formula
should be something like this in cell b10: =IF(ISBLANK
(C10)," ",CTRL+;)

My goal is to have the date "stamped" into a spreadsheet
entry toregister when a delivery is made.

But I don't know how to get Excel to recognize the three
keystrokes. Any help would be greatly appreciated!





All times are GMT +1. The time now is 09:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com