Custom Search

Tutorial:

SQL
VBA

Home >> VBA Macro's >> Data Entry Solution

Data Entry Solution

Suppose every day you type data into excel and every time you have to insert the date manually. This may be time consuming. Suppose you use five columns to enter the data A, B, C, D and E. E is for date. So you want Column E need to automatically filled with date before you enter new record in next row. Here is the code for this.



Private Sub Worksheet_SelectionChange(ByVal Target As Range)
 
 If Target.Column = 1 Then
  
    If Target.Row > 1 Then
   
       If Target.Offset(-1, 0).Value <> "" Then
    
          Target.Offset(-1, 4).Value = Date
   
       End If
  
    End If
 
 End If

End Sub