Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Want to calculate the appointment date and deappointment date?
Hi All, Greeting for the day. I have date 12-Jul-09 in cell A1 If i enter "APPT" In cell B2 then C2 have to show 11-Jul-09 (D-1) If it is "DEPPT" IN Cell B2 then C2 have to show 13-Jul-09 (D+1) Note : This APPT and DEPPT will be mixed together ill just copy paste them into a Sheet when i do that i need a VBA program to show these days automatically. Any help would be appreicated. Regards, Raja -- Raja ------------------------------------------------------------------------ Raja's Profile: http://www.thecodecage.com/forumz/member.php?userid=497 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=115205 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Want to calculate the appointment date and deappointment date?
Copy and paste this to your worksheet code module.
Private Sub Worksheet_Change(ByVal Target As Range) If Target = Range("B2") Then Range("C2").NumberFormat = "dd-mmm-yy" If Target.Value = "APPT" Then Range("C2") = Date - 1 ElseIf Target.Value = "DEPPT" Then Range("C2") = Date + 1 End If End If End Sub "Raja" wrote in message ... Hi All, Greeting for the day. I have date 12-Jul-09 in cell A1 If i enter "APPT" In cell B2 then C2 have to show 11-Jul-09 (D-1) If it is "DEPPT" IN Cell B2 then C2 have to show 13-Jul-09 (D+1) Note : This APPT and DEPPT will be mixed together ill just copy paste them into a Sheet when i do that i need a VBA program to show these days automatically. Any help would be appreicated. Regards, Raja -- Raja ------------------------------------------------------------------------ Raja's Profile: http://www.thecodecage.com/forumz/member.php?userid=497 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=115205 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Want to calculate the appointment date and deappointment date?
I should have read your post more closely. You want to base the change on
the value in A1, I believe. Private Sub Worksheet_Change(ByVal Target As Range) If Target = Range("B2") Then Range("C2").NumberFormat = "dd-mmm-yy" If Target.Value = "APPT" Then Range("C2") = Range("A1").Value - 1 ElseIf Target.Value = "DEPPT" Then Range("C2") = Range("A1").Value + 1 End If End If End Sub "Raja" wrote in message ... Hi All, Greeting for the day. I have date 12-Jul-09 in cell A1 If i enter "APPT" In cell B2 then C2 have to show 11-Jul-09 (D-1) If it is "DEPPT" IN Cell B2 then C2 have to show 13-Jul-09 (D+1) Note : This APPT and DEPPT will be mixed together ill just copy paste them into a Sheet when i do that i need a VBA program to show these days automatically. Any help would be appreicated. Regards, Raja -- Raja ------------------------------------------------------------------------ Raja's Profile: http://www.thecodecage.com/forumz/member.php?userid=497 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=115205 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Want to calculate the appointment date and deappointment date?
JLGWhiz;413560 Wrote: Copy and paste this to your worksheet code module. Private Sub Worksheet_Change(ByVal Target As Range) If Target = Range("B2") Then Range("C2").NumberFormat = "dd-mmm-yy" If Target.Value = "APPT" Then Range("C2") = Date - 1 ElseIf Target.Value = "DEPPT" Then Range("C2") = Date + 1 End If End If End Sub "Raja" wrote in message ... Hi All, Greeting for the day. I have date 12-Jul-09 in cell A1 If i enter "APPT" In cell B2 then C2 have to show 11-Jul-09 (D-1) If it is "DEPPT" IN Cell B2 then C2 have to show 13-Jul-09 (D+1) Note : This APPT and DEPPT will be mixed together ill just copy paste them into a Sheet when i do that i need a VBA program to show these days automatically. Any help would be appreicated. Regards, Raja -- Raja ------------------------------------------------------------------------ Raja's Profile: 'The Code Cage Forums - View Profile: Raja' (http://www.thecodecage.com/forumz/member.php?userid=497) View this thread: 'Want to calculate the appointment date and deappointment date? - The Code Cage Forums' (http://www.thecodecage.com/forumz/sh...d.php?t=115205) Thanks but its not working. please advice... Raja -- Raja ------------------------------------------------------------------------ Raja's Profile: http://www.thecodecage.com/forumz/member.php?userid=497 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=115205 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Want to calculate the appointment date and deappointment date?
Hi JLGWhiz, Your code working only for the B2 in the example i had mentioned it for the understanding.Ok to explain you further say ill always copy paste the date in A:A and "APPT" OR DEAPPT" IN B:B and i need those outcome in C:C always. Sorry for not explaining them earlier. Many thanks, Raja -- Raja ------------------------------------------------------------------------ Raja's Profile: http://www.thecodecage.com/forumz/member.php?userid=497 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=115205 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
calculate the date from ceased work date after a certain waiting p | Excel Discussion (Misc queries) | |||
Trying to calculate end date using order date and lead time variab | Excel Worksheet Functions | |||
Auto calculate for date + days forward to yield new date | Excel Worksheet Functions | |||
formula to calculate future date from date in cell plus days | Excel Worksheet Functions | |||
date stamp & appointment tru excel | Excel Programming |