Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
In cell drop down menu with seprerate numerical target cell | Excel Discussion (Misc queries) | |||
How to update cell on change | Excel Discussion (Misc queries) | |||
Populating Last Saved Date in Cell AND also update that same cell in Header | Excel Discussion (Misc queries) | |||
In adjacent cell, show last date modified of target cell. | Excel Discussion (Misc queries) | |||
How to update a cell if a specific date is included in a date rang | Setting up and Configuration of Excel |