Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Update a date cell when a target cell change....

I am try to automatic update a date cell when the target cell changes.
A1 is what I need, A2 is what I had, A3 is the inventory date. I want to
made it whenever A2 change, A3 will automatic update to the current date. If
not, A3 should stay unchange with the last inventory date.

Thanks in advance for your help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Update a date cell when a target cell change....

This goes into the worksheet's _Change event code. To get there, right-click
on the sheet tab and choose [View Code] from the list.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$A$2" Then
Exit Sub
End If
Range("A3") = Now()
End Sub

If you need to deal with cells other than A2 and A3, then we need to know a
little more about how your worksheet is laid out.

"chongcc" wrote:

I am try to automatic update a date cell when the target cell changes.
A1 is what I need, A2 is what I had, A3 is the inventory date. I want to
made it whenever A2 change, A3 will automatic update to the current date. If
not, A3 should stay unchange with the last inventory date.

Thanks in advance for your help.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Update a date cell when a target cell change....

Yes, that help. Got another question if you don't mind. I had A1:B12 locked
and protect, and the code can't write to those cells. How can I unlock it,
write to it and lock it again. Thanks.

"JLatham" wrote:

This goes into the worksheet's _Change event code. To get there, right-click
on the sheet tab and choose [View Code] from the list.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$A$2" Then
Exit Sub
End If
Range("A3") = Now()
End Sub

If you need to deal with cells other than A2 and A3, then we need to know a
little more about how your worksheet is laid out.

"chongcc" wrote:

I am try to automatic update a date cell when the target cell changes.
A1 is what I need, A2 is what I had, A3 is the inventory date. I want to
made it whenever A2 change, A3 will automatic update to the current date. If
not, A3 should stay unchange with the last inventory date.

Thanks in advance for your help.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Update a date cell when a target cell change....

Do the unprotect and protect within the code, as

ActiveSheet.Unprotect
Range("A3") = Now()
ActiveSheet.Protect

If the sheet is password protected, then
ActiveSheet.Unprotect Password:="thepassw0rd"
Range("A3") = Now()
ActiveSheet.Protect Password:="thepassw0rd"


"chongcc" wrote:

Yes, that help. Got another question if you don't mind. I had A1:B12 locked
and protect, and the code can't write to those cells. How can I unlock it,
write to it and lock it again. Thanks.

"JLatham" wrote:

This goes into the worksheet's _Change event code. To get there, right-click
on the sheet tab and choose [View Code] from the list.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$A$2" Then
Exit Sub
End If
Range("A3") = Now()
End Sub

If you need to deal with cells other than A2 and A3, then we need to know a
little more about how your worksheet is laid out.

"chongcc" wrote:

I am try to automatic update a date cell when the target cell changes.
A1 is what I need, A2 is what I had, A3 is the inventory date. I want to
made it whenever A2 change, A3 will automatic update to the current date. If
not, A3 should stay unchange with the last inventory date.

Thanks in advance for your help.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Update a date cell when a target cell change....

That's just what I am looking for and it works great. Thanks a lot.

"JLatham" wrote:

Do the unprotect and protect within the code, as

ActiveSheet.Unprotect
Range("A3") = Now()
ActiveSheet.Protect

If the sheet is password protected, then
ActiveSheet.Unprotect Password:="thepassw0rd"
Range("A3") = Now()
ActiveSheet.Protect Password:="thepassw0rd"


"chongcc" wrote:

Yes, that help. Got another question if you don't mind. I had A1:B12 locked
and protect, and the code can't write to those cells. How can I unlock it,
write to it and lock it again. Thanks.

"JLatham" wrote:

This goes into the worksheet's _Change event code. To get there, right-click
on the sheet tab and choose [View Code] from the list.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$A$2" Then
Exit Sub
End If
Range("A3") = Now()
End Sub

If you need to deal with cells other than A2 and A3, then we need to know a
little more about how your worksheet is laid out.

"chongcc" wrote:

I am try to automatic update a date cell when the target cell changes.
A1 is what I need, A2 is what I had, A3 is the inventory date. I want to
made it whenever A2 change, A3 will automatic update to the current date. If
not, A3 should stay unchange with the last inventory date.

Thanks in advance for your help.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Update a date cell when a target cell change....

I thought it might be. You're welcome and thank you for the thank you and
letting us know it worked.

"chongcc" wrote:

That's just what I am looking for and it works great. Thanks a lot.

"JLatham" wrote:

Do the unprotect and protect within the code, as

ActiveSheet.Unprotect
Range("A3") = Now()
ActiveSheet.Protect

If the sheet is password protected, then
ActiveSheet.Unprotect Password:="thepassw0rd"
Range("A3") = Now()
ActiveSheet.Protect Password:="thepassw0rd"


"chongcc" wrote:

Yes, that help. Got another question if you don't mind. I had A1:B12 locked
and protect, and the code can't write to those cells. How can I unlock it,
write to it and lock it again. Thanks.

"JLatham" wrote:

This goes into the worksheet's _Change event code. To get there, right-click
on the sheet tab and choose [View Code] from the list.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$A$2" Then
Exit Sub
End If
Range("A3") = Now()
End Sub

If you need to deal with cells other than A2 and A3, then we need to know a
little more about how your worksheet is laid out.

"chongcc" wrote:

I am try to automatic update a date cell when the target cell changes.
A1 is what I need, A2 is what I had, A3 is the inventory date. I want to
made it whenever A2 change, A3 will automatic update to the current date. If
not, A3 should stay unchange with the last inventory date.

Thanks in advance for your help.

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
In cell drop down menu with seprerate numerical target cell Remco Excel Discussion (Misc queries) 2 October 24th 06 11:39 AM
How to update cell on change J.P. Excel Discussion (Misc queries) 5 July 11th 06 01:37 AM
Populating Last Saved Date in Cell AND also update that same cell in Header o0o_Bigs_o0o Excel Discussion (Misc queries) 2 July 4th 06 12:56 PM
In adjacent cell, show last date modified of target cell. manxman Excel Discussion (Misc queries) 0 March 17th 06 10:47 PM
How to update a cell if a specific date is included in a date rang mgavidia Setting up and Configuration of Excel 2 October 8th 05 12:53 AM


All times are GMT +1. The time now is 12:32 AM.

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

About Us

"It's about Microsoft Excel"