autocalculating due dates based on frequency (weeks)

MDisbrow

New Member
Joined
Sep 12, 2022
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
Hello Excel Gurus!
First time poster here :)
I am trying to set up a spreadsheet for a psychiatric provider to use to track when clients need to be seen. Ideally, I would like it to be the last name, first name, frequency, last seen date, needs to be seen date. I know how to do the basic last seen to next seen (B2+30) however, that would require the provider to change the formula if a client needs to be seen every 2 weeks versus 4. She struggles with technology so I was hoping there is a way she could just update her "last seen date" and choose a frequency of 1 week, 2 week, 3 week, or 4 week to auto-populate the new "due date" for the client to be seen next. I have attached a screen shot of the spreadsheet so far but need help please!

*Note--pretend I know nothing about excel in your response as I know very little*

Thank YOU!
 

Attachments

  • ss.PNG
    ss.PNG
    14.1 KB · Views: 17

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Click here to download your file. Enter the data starting in column A. In column C, enter only the number of weeks, so for three weeks, enter a 3. When you click in column D, a calendar will pop up for you to select a "Last Seen" date. After the date is selected, the due date will populate automatically. To view the code, do the following: right click the tab name for your sheet and click 'View Code'. Close the code window to return to your sheet.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Target.Column <> 4 Then Exit Sub
    Target.Offset(, 1) = DateAdd("ww", Target.Offset(, -1), Target)
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Intersect(Target, Range("D:D")) Is Nothing Then Exit Sub
    CalendarFrm.Show
    Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
Solution
Set up your sheet to look like this:
Book1
ABCDE
1LastFirstFrequency in WeeksLast SeenDue
2
3
4
5
6
7
Sheet1

Copy and paste this code into the worksheet code module. Do the following: right click the tab name for your sheet and click 'View Code'. Paste the code into the empty code window that opens up. Close the code window to return to your sheet. Enter the data starting in column A. In column C, enter only the number of weeks, so for three weeks, enter a 3. When you click in column D, a calendar will pop up for you to select a "Last Seen" date. After the date is selected, the due date will populate automatically.
Which code and I copy and pasting?
 
Upvote 0
Try replacing the existing part of code with this:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Intersect(Target, Range("D:D")) Is Nothing Then Exit Sub
    CalendarFrm.Show
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Try replacing the existing part of code with this:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Intersect(Target, Range("D:D")) Is Nothing Then Exit Sub
    CalendarFrm.Show
    Application.ScreenUpdating = True
End Sub
Which part of the code do I replace:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Column <> 4 Then Exit Sub
Target.Offset(, 1) = DateAdd("ww", Target.Offset(, -1), Target)
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("D:D")) Is Nothing Then Exit Sub
CalendarFrm.Show
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top