Solved How to insert dates in next cell when a letter is entered

May 13, 2015 at 03:48:57
Specs: Windows 7
1. If I enter letter "C" in A1 then B1 must give me today's date plus 7 days.

2. If I enter letter "B" in A1 then B1 must give me today's date plus three days

3. If I enter letter "A" in A1 the B1 must give me the following day's date.

Excel of course...

Pleazzzzzze!

message edited by RobbieRSA


See More: How to insert dates in next cell when a letter is entered

Report •


#1
May 13, 2015 at 03:58:19
Before we can answer your question we need more information.

If you use a Formula based solution, the value in B1 will change every day because it will always update based on whatever is the current "today's date".

If you are looking for a fixed entry that will give you the date you have asked for and then keep it constant, you will need to use a macro or a manual copy/paste procedure after the formula computes the date.

Which one are you looking for?

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

message edited by DerbyDad03


Report •

#2
May 13, 2015 at 04:11:24
Constant date please Derbydad.
in safety an "A" hazard must be fixed by a certain date and I want to save the report for future reference...

Report •

#3
May 13, 2015 at 07:26:23
✔ Best Answer
This might get you started. Paste this macro into the Sheet module for the sheet in which you want the dates inserted. (Right Click the sheet tab and choose View Code, then Right Click...Paste)

The code will monitor the sheet and if a change is made in Column A, it will check for an A, B or C in the row that was changed and insert a date in Column B based on what it finds. As written, if anything other than an A, B or C is entered in Column A or if more than one cell is changed at the same time or if the value in Column A is deleted, the code will do nothing.


Private Sub Worksheet_Change(ByVal Target As Range)
'Do nothing if more than one cell is changed or content deleted
  If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
'Determine if change was made to Column A
    If Target.Column = 1 Then
'Enter Date in Column B based on entry in Column A
     If Target = "A" Then Target.Offset(0, 1) = Date + 1
     If Target = "B" Then Target.Offset(0, 1) = Date + 3
     If Target = "C" Then Target.Offset(0, 1) = Date + 7
    End If
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

Related Solutions


Ask Question