Forum Discussion
Inputting data to correlate with a date
Brad Yundt I think I understand what you mean, but unless I am mistaken I don't think that will help me the way I have the spreadsheet set up. I'll try to use a better example.
Date 1 2 3 4 5 6 7 8
Alan
Bob
Chris
David
The way I have it set up, Alan would click on his name today (the 1st of the month), which would hyperlink to a simple list of questions. These questions would result in a single digit overall "score" for that day. That score would populate under 1 just using the "=!AlanC5" for example. This all works fine. The problem comes when tomorrow Alan clicks his name and gets the same set of questions, but potentially resulting in a different overall "score" - how do I get the master document (shown above) to put the new score in box 2 and not change box 1?
Hope that all makes sense! I am happy to link what I have created so far if that helps.
- Dirk_gently25Jul 11, 2019Copper Contributor
Twifoo Please see attached file. This is an early work in progress to show the current problem. All I would like to demonstrate is Alan logging in today and filling out his information, this should be saved under the correct date in the master tab. When Alan logs in again tomorrow, the data should be saved under the new date but the old data/date should not be changed.
- TwifooJul 12, 2019Silver Contributor
To achieve your desired results, you need VBA, which is not my forte. Certainly, the other experts here can help you with that.
- Brad_YundtJul 12, 2019MVP
Here is a macro that will track entries made in C4:C9 in the various worksheets, and will report the fatigue score to the appropriate date for that person on the Master worksheet. Because the code is not putting a formula in the cell, the scores will be retained as time goes on. The code must be installed in ThisWorkbook code pane. Also, you must save the workbook with .xls, .xlsm or .xlsb file extension (.xlsx will remove the code).
The code is not looking for the green column to enter the data. Instead, it is matching the date from Alan's cell C1 with the dates in Master row 3.
'Put this code in ThisWorkbook code pane. It won't work at all if installed anywhere else! Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) Dim cel As Range, targ As Range Dim i As Long, j As Long Select Case Sh.Name Case "Splash Screen", "Master", "DPGs" 'Ignore these worksheets Case Else Set targ = Sh.Range("C4:C9") 'Watch these cells for changes Set targ = Intersect(targ, Target) If Not targ Is Nothing Then Application.EnableEvents = False With Worksheets("Master") i = Application.Match(Sh.Name, .Columns(1), 0) j = Application.Match(Sh.Range("C1"), .Rows(3), 0) .Cells(i, j).Value = Sh.Range("C15").Value End With Application.EnableEvents = True End If End Select End Sub