ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Absolute Dates (https://www.excelbanter.com/excel-discussion-misc-queries/50225-absolute-dates.html)

colm1976

Absolute Dates
 
I WOULD LIKE TO CREATE A WORKSHEET WHERE THE DATE IS AUTOMATICALLY PUT INTO A
CELL WHENEVER THE OPERATOR INPUTS INFORMATION INTO ANOTHER CELL... I.E. CELL
A IS THE DATE OF INPUT... CELL B IS WHERE THE OPERATOR INPUTS INFORMATION...
BUT I DON'T WANT TO HAVE THE OPERATOR INPUT THE DATEE - NOR DO I WANT IT
REFRESHED EVERY TIME I OPEN THE FILE... ANY HELP???? THANKS IN ADVANCE!

colm1976

Thank you for the reply. I have not pasted code before. I found the section
to paste but do not know how to activate it. Column A is the date field and
column F is where the text is being entered. Thank you in advance.

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:H10"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Column = 2 Then
Target.Offset(0, -1).Value = Format(Date, "dd mmm yyyy")
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
(remove nothere from the email address if mailing direct)


"colm1976" wrote in message
...
I WOULD LIKE TO CREATE A WORKSHEET WHERE THE DATE IS AUTOMATICALLY PUT

INTO A
CELL WHENEVER THE OPERATOR INPUTS INFORMATION INTO ANOTHER CELL... I.E.

CELL
A IS THE DATE OF INPUT... CELL B IS WHERE THE OPERATOR INPUTS

INFORMATION...
BUT I DON'T WANT TO HAVE THE OPERATOR INPUT THE DATEE - NOR DO I WANT IT
REFRESHED EVERY TIME I OPEN THE FILE... ANY HELP???? THANKS IN ADVANCE!





Bob Phillips

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:H10"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Column = 2 Then
Target.Offset(0, -1).Value = Format(Date, "dd mmm yyyy")
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
(remove nothere from the email address if mailing direct)


"colm1976" wrote in message
...
I WOULD LIKE TO CREATE A WORKSHEET WHERE THE DATE IS AUTOMATICALLY PUT

INTO A
CELL WHENEVER THE OPERATOR INPUTS INFORMATION INTO ANOTHER CELL... I.E.

CELL
A IS THE DATE OF INPUT... CELL B IS WHERE THE OPERATOR INPUTS

INFORMATION...
BUT I DON'T WANT TO HAVE THE OPERATOR INPUT THE DATEE - NOR DO I WANT IT
REFRESHED EVERY TIME I OPEN THE FILE... ANY HELP???? THANKS IN ADVANCE!




Bob Phillips

Use this code then. The date will be input every time you enter datat in F.

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Column = 6 Then
Target.Offset(0, -5).Value = Format(Date, "dd mmm yyyy")
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
(remove nothere from the email address if mailing direct)


"colm1976" wrote in message
...
Thank you for the reply. I have not pasted code before. I found the

section
to paste but do not know how to activate it. Column A is the date field

and
column F is where the text is being entered. Thank you in advance.

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:H10"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Column = 2 Then
Target.Offset(0, -1).Value = Format(Date, "dd mmm yyyy")
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
(remove nothere from the email address if mailing direct)


"colm1976" wrote in message
...
I WOULD LIKE TO CREATE A WORKSHEET WHERE THE DATE IS AUTOMATICALLY PUT

INTO A
CELL WHENEVER THE OPERATOR INPUTS INFORMATION INTO ANOTHER CELL...

I.E.
CELL
A IS THE DATE OF INPUT... CELL B IS WHERE THE OPERATOR INPUTS

INFORMATION...
BUT I DON'T WANT TO HAVE THE OPERATOR INPUT THE DATEE - NOR DO I WANT

IT
REFRESHED EVERY TIME I OPEN THE FILE... ANY HELP???? THANKS IN

ADVANCE!







All times are GMT +1. The time now is 08:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com