![]() |
Dates
Hi (again!),
I have a 3 columns for actions on a register. Planned end date (V), actual end date (W) and why was the date pushed out? (X). If the planned and actualy end date are the same this is fine and the spreadsheet flags it that the action has been closed. If they actual date is after the planned date its states it has been pushed out. How do I get it to bring up and input box when the actual date is entered in W and the dates are different? The information entered in the input box will be stored in column X. Thanks for your help |
Dates
You need a worksheet change function use the one below
to Install 1) copy code below from the word SUB to the last line END SUB. 2) Go to worksheet tabe on bottom of page the initially said Sheet1 3) Right click and select View Code 4) Paste code into VBA window. 5) remove the if necessary that this website sometime inserts. Go to workbook and try it, your'll like it. Sub worksheet_change(ByVal Target As Range) If Target.Column = 23 Then If Target < Cells(Target.Row, 22) Then ReasonWhy = InputBox("Enter Reason date was Pushed back") Cells(Target.Row, 24) = ReasonWhy End If End If End Sub "Pasty" wrote: Hi (again!), I have a 3 columns for actions on a register. Planned end date (V), actual end date (W) and why was the date pushed out? (X). If the planned and actualy end date are the same this is fine and the spreadsheet flags it that the action has been closed. If they actual date is after the planned date its states it has been pushed out. How do I get it to bring up and input box when the actual date is entered in W and the dates are different? The information entered in the input box will be stored in column X. Thanks for your help |
Dates
That's brilliant thank you - only one thing - if I click on the cell and the
date is blank it reads it as a different date and asks for narrative is there anything I can enter to make it exit the sub if the cell is empty? "Joel" wrote: You need a worksheet change function use the one below to Install 1) copy code below from the word SUB to the last line END SUB. 2) Go to worksheet tabe on bottom of page the initially said Sheet1 3) Right click and select View Code 4) Paste code into VBA window. 5) remove the if necessary that this website sometime inserts. Go to workbook and try it, your'll like it. Sub worksheet_change(ByVal Target As Range) If Target.Column = 23 Then If Target < Cells(Target.Row, 22) Then ReasonWhy = InputBox("Enter Reason date was Pushed back") Cells(Target.Row, 24) = ReasonWhy End If End If End Sub "Pasty" wrote: Hi (again!), I have a 3 columns for actions on a register. Planned end date (V), actual end date (W) and why was the date pushed out? (X). If the planned and actualy end date are the same this is fine and the spreadsheet flags it that the action has been closed. If they actual date is after the planned date its states it has been pushed out. How do I get it to bring up and input box when the actual date is entered in W and the dates are different? The information entered in the input box will be stored in column X. Thanks for your help |
Dates
Patsy,
If Joel will excuse me playing with his code then substituting this line should fix your problem. If Target "" And Target < Cells(Target.Row, 22) Then Mike "Pasty" wrote: That's brilliant thank you - only one thing - if I click on the cell and the date is blank it reads it as a different date and asks for narrative is there anything I can enter to make it exit the sub if the cell is empty? "Joel" wrote: You need a worksheet change function use the one below to Install 1) copy code below from the word SUB to the last line END SUB. 2) Go to worksheet tabe on bottom of page the initially said Sheet1 3) Right click and select View Code 4) Paste code into VBA window. 5) remove the if necessary that this website sometime inserts. Go to workbook and try it, your'll like it. Sub worksheet_change(ByVal Target As Range) If Target.Column = 23 Then If Target < Cells(Target.Row, 22) Then ReasonWhy = InputBox("Enter Reason date was Pushed back") Cells(Target.Row, 24) = ReasonWhy End If End If End Sub "Pasty" wrote: Hi (again!), I have a 3 columns for actions on a register. Planned end date (V), actual end date (W) and why was the date pushed out? (X). If the planned and actualy end date are the same this is fine and the spreadsheet flags it that the action has been closed. If they actual date is after the planned date its states it has been pushed out. How do I get it to bring up and input box when the actual date is entered in W and the dates are different? The information entered in the input box will be stored in column X. Thanks for your help |
All times are GMT +1. The time now is 12:10 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com