View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Problems with vb in excel

John,

This code will put the date in column A if a change is made to B1:B100

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B1:B100")) Is Nothing Then
With Target
.Offset(0, -1).Value = Format(Date, "dd mmm yyyy")
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

--

HTH

RP

"Johnsey" wrote in message
...

I've been trying to get these to work in excel but i'm not having much
luck can anyone point me in the right direction. I've put the code
into vb editor now what do i do?

Private Sub Worksheet_Change(ByVal Target As Range)
Range("A" & Target.Row) = Now()
End Sub

-----------

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
Range("C" & Target.Row).Value = Now()
End If
End Sub

I'm trying 2 date stamp a cell when the cell next to it = yes but i
want it as a fixed date all the other ways i tried the date would auto
update

F2 is the column with yes in
G2 is the column i want the dates in


--
Johnsey
------------------------------------------------------------------------
Johnsey's Profile:

http://www.excelforum.com/member.php...o&userid=15560
View this thread: http://www.excelforum.com/showthread...hreadid=273358