Try this
Sub Insert_date()
' Written by Barrie Davidson
If Sheets("sheet1").Range("G27") <> "" Then
Sheets("sheet1").Range("s2").Value = Now
Sheets("sheet2").Range("s2").Value = Now
End If
End Sub
Regards,
BarrieBarrie Davidson
Barrie I could not get this to work, I tried it in a module and in the sheet code, where does it need to go. I forgot to say I am using excel '97. I must not be doing something right
The code should be put in a module. This worked fine for me when I tested it. Do you have sheets named "Sheet1" and "Sheet2" in your workbook or are they named "Sheet 1" and "Sheet 2"?
Barrie
I could not get this to work, I tried it in a module and in the sheet code, where does it need to go. I forgot to say I am using excel '97. I must not be doing something right
Barrie Davidson
Sorry, your Marco works fine, when I ran it, but I need it to automatically put the date in when something is put in put in G27 I could not get this to work, I tried it in a module and in the sheet code, where does it need to go. I forgot to say I am using excel '97. I must not be doing something right
Okay, put this code in the worksheet's code
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
' Written by Barrie Davidson
If Target.Address = "$G$27" And Target.Value <> "" Then
Sheets("sheet1").Range("s2").Value = Now
Sheets("sheet2").Range("s2").Value = Now
End If
End Sub
Regards,
Barrie
Sorry, your Marco works fine, when I ran it, but I need it to automatically put the date in when something is put in put in G27 : The code should be put in a module. This worked fine for me when I tested it. Do you have sheets named "Sheet1" and "Sheet2" in your workbook or are they named "Sheet 1" and "Sheet 2"? : Barrie : I could not get this to work, I tried it in a module and in the sheet code, where does it need to go. I forgot to say I am using excel '97. I must not be doing something right
Barrie Davidson
Private Sub Worksheet_Change(ByVal Target As Excel.Range)