View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben[_2_] Gord Dibben[_2_] is offline
external usenet poster
 
Posts: 621
Default Fixing date of entry

Good to hear.

Gord

On Tue, 10 May 2011 01:47:45 +0100, Colin Hayes
wrote:



HI

OK thanks for your time and expertise. It's working perfectly.

Best Wishes ,


In article , Gord Dibben
writes
and assume I need to enter
the code under each tab


Incorrect assumption.

When you need the same code in multiple worksheets, you can place the code
once
in Thisworkbook module and cover all sheets.

Put this revised code in Thisworkbook Module under Microsoft Excel Objects in
VBE

Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Range)
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 2 Then
n = Target.Row
With ActiveSheet
If .Range("B" & n).Value < "" Then
.Range("A" & n).Value = Date
Else: .Range("A" & n).Value = ""
End If
End With
End If
enditall:
Application.EnableEvents = True
End Sub

Delete the previous code you copied to any worksheet module.