Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Put Value in a cell next to the active cell
Hi
I have a calendar control which populates cells X$3$ to $X$2580. So If I select cell X$5$ the calendar pops up and I select a date and this is then entered into cell X5. What I also want to do is put Now() into cell $W$5 I have never used VBA in excel before only in access, so dont know about active cells any help greatly appreciated Thanks Richard |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Put Value in a cell next to the active cell
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "X3:X2580" '<== change to suit On Error GoTo ws_exit Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target .Offset(0, -1).Value = Now .Offset(0, -1).NumberFormat = "dd mmm yyyy hh:mm:ss" 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 Bob "richard" wrote in message ... Hi I have a calendar control which populates cells X$3$ to $X$2580. So If I select cell X$5$ the calendar pops up and I select a date and this is then entered into cell X5. What I also want to do is put Now() into cell $W$5 I have never used VBA in excel before only in access, so dont know about active cells any help greatly appreciated Thanks Richard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Row select mode to highlight active row of active cell | Excel Discussion (Misc queries) | |||
run macro although blinking cursor is active in an active cell | Excel Programming | |||
referring to formula in a non active cell from active cell | Excel Discussion (Misc queries) | |||
I need to sort an active sheet using the col of the active cell | Excel Programming | |||
find text in a cell and make cell 2 cells below that active | Excel Programming |