Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problems with vb in excel
I've been trying to get these to work in excel but i'm not having muc luck can anyone point me in the right direction. I've put the cod 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 want it as a fixed date all the other ways i tried the date would aut update F2 is the column with yes in G2 is the column i want the dates i -- Johnse ----------------------------------------------------------------------- Johnsey's Profile: http://www.excelforum.com/member.php...fo&userid=1556 View this thread: http://www.excelforum.com/showthread.php?threadid=27335 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problems with vb in excel
Hi
you have to put this code in your worksheet module (not in a stadard module). Also change them to: Private Sub Worksheet_Change(ByVal Target As Range) application.enableevents=false Range("A" & Target.Row) = Now() application.enableevents=true End Sub ----------- Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 Then application.enableevents=false Range("C" & Target.Row).Value = Now() End If application.enableevents=true End Sub -- Regards Frank Kabel Frankfurt, Germany "Johnsey" schrieb im Newsbeitrag ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
aauugghhh...#div/o problems & various average formula problems | Excel Worksheet Functions | |||
Problems using Excel 2000 to open/save file saved in Excel 2003 | Excel Discussion (Misc queries) | |||
Problems with excel please help | Excel Discussion (Misc queries) | |||
Excel SUM problems | Excel Worksheet Functions | |||
Problems merging an excel file due to code or file problems? | Excel Programming |