Forum Discussion
Dirk_gently25
Jul 09, 2019Copper Contributor
Inputting data to correlate with a date
Hi all, I am trying to learn Excel as I go along so please feel free to tell me if there is a better way to achieve what I am doing. I have a master tab showing dates along the top and names down t...
Twifoo
Jul 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_Yundt
Jul 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