Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Row select mode to highlight active row of active cell Bart Fay[_2_] Excel Discussion (Misc queries) 0 May 11th 10 09:34 PM
run macro although blinking cursor is active in an active cell bartman1980 Excel Programming 1 December 20th 07 11:29 AM
referring to formula in a non active cell from active cell nickname Excel Discussion (Misc queries) 1 June 21st 07 12:11 PM
I need to sort an active sheet using the col of the active cell HamFlyer Excel Programming 3 June 6th 06 07:25 PM
find text in a cell and make cell 2 cells below that active shark102 Excel Programming 4 October 20th 05 02:41 PM


All times are GMT +1. The time now is 06:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"