if statement for date

sunshine076

Registered User.
Local time
Today, 12:02
Joined
Apr 6, 2009
Messages
160
Is there a way to have the date show up in a different cell when an entry has been made on the sheet.

For example:
Cell C3 has N then in cell F will show the date of entry
 
Put the following in the ThisWorkbook object shown in the VBA Editor

Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

If Sh.Name = "SheetName" And Target.Column = 3 Then Sh.Range("F" & Target.Row) = Date
    
End Sub
 
It worked Thank you
 
why is it that when I enter in data in column 3 it moves to a different tab and you have to constantly click back into the tab that I am working in. Here is the code that I have so far.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Sh.Name = "ToolChange" And Target.Column = 3 Then Sh.Range("W" & Target.Row) = Date
If Sh.Name = "ToolChange" And Target.Column = 3 Then Sh.Range("X" & Target.Row) = Time
Application.Run "eovl_stuff.xls!Protection.Protectall", True
End Sub

I think the problem lies in the application.run
 
Yeah it is something in sub you are calling that is changing the sheet

Just add:

Code:
sh.activate

after the application.run
 

Users who are viewing this thread

Back
Top Bottom