#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default 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


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
Linking computer dates (time) to spreadsheet dates that have formu bigisle Excel Worksheet Functions 3 January 3rd 10 08:05 PM
Stop dates from showing as numbers - when formated as dates JR Excel Discussion (Misc queries) 1 October 29th 08 04:38 PM
how do I sort a column of random dates into Consecutive dates Rob Gibson Excel Worksheet Functions 2 June 12th 07 05:10 AM
Toggle a range of Julian dates to Gregorian Dates and Back PSKelligan Excel Programming 4 May 8th 07 05:51 AM
Identifying unique dates within a range of cells containing dates cdavidson Excel Discussion (Misc queries) 0 October 12th 06 08:19 PM


All times are GMT +1. The time now is 11:17 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"