Automation for training sheet

David Clark

New Member
Joined
May 21, 2024
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Good day all,

I am an officer with a Volunteer Fire Department and I am looking for some help building automation into my training files. I have an excel book with 50+ sheets for each active member of the department. This file is used to keep records of all mandatory training needed to remain an active riding member in the department. In the 2 images uploaded, one is the single sheet per member and the second is a full list of each member and trainings.

What I am trying to do is pull the data from the "Required Certifications" members sheet to the "testing" sheet and then it would place an X on the completed training once I enter anything into the information date section. I will then be using the "training" sheet to make a pivot table(no help needed with pivot table) that I can then send to the membership to show where we all stand at the 6 month mark of the year for completions.

If I can get a formula for one of the categories I believe I can change the needed formula to also pull from the others.

Thank you in advance and if this is too much of an ask or hard to do I can revert to how it used to be done by just adding the X myself like my predecessor did.
 

Attachments

  • Testing sheet.png
    Testing sheet.png
    70.9 KB · Views: 34
  • Required Certifications sheet.png
    Required Certifications sheet.png
    61.5 KB · Views: 34
@Snakehips Im always up for learning something new, Like I said though I have no knowledge of VBA, if that doesnt bother you Im in for the learning!
Let's go for it. Not a lot to be lost if it doesn't suit your needs.

Can you confirm or correct the following assumptions;
The name in D6 will match a name in Testing Sheet column A
The Date entry cells (Red) are 2 columns merged.

You will make single entries or clearances in a member's certification sheet.
Generally, no multi-cell pasting or contents clearing.
Making an entry into a Date cell to place an X in the appropriate cell of Testing Sheet.
Clearing an entry from a Date cell to remove an X from the appropriate cell of Testing Sheet.
X in column S only if 2 or more Elective Classes are dated.

Do you currently see the Developer Tab in your quick access toolbar?
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Let's go for it. Not a lot to be lost if it doesn't suit your needs.

Can you confirm or correct the following assumptions;
The name in D6 will match a name in Testing Sheet column A
The Date entry cells (Red) are 2 columns merged.

You will make single entries or clearances in a member's certification sheet.
Generally, no multi-cell pasting or contents clearing.
Making an entry into a Date cell to place an X in the appropriate cell of Testing Sheet.
Clearing an entry from a Date cell to remove an X from the appropriate cell of Testing Sheet.
X in column S only if 2 or more Elective Classes are dated.

Do you currently see the Developer Tab in your quick access toolbar?
@Snakehips I apologize for letting your question sit for so long. I had some items in life happen and missed the email saying you had replied to this thread.
Currently the name in D6 does NOT match the sheet name, D6 is First / last and sheet is Last, First(however that is an easy change)

Yes the date entry cells in red are merged.
Correct I would make the change to the member sheet when a class / training is completed.
Correct- no multi-cell pasting is usually done
Correct- Once the date is populated in the member sheet then an X would go into the "testing" sheet(name would change most likely later)
Correct- When a cell with a date in it on the members sheet it would then clear the X from the testing sheet
Correct- X in column S only if 2 or more elective classes are dated.
 
Upvote 0
@David Clark Below you will find code that may or not be of value.
Also are my testing sheets. You can test using these or maybe on a backed-up copy of a couple of your own sheets.
Copy the code. Open the vba editor and double click on the test member sheet (s). Post the code into the sheet's code pane.

The code should then auto-run as and when there is a change in the sheet, and reflect any added or removed dates with X's in the 'Testing Sheet'.
As it is stands, It assumes the name in the member sheet can be found in the Testing Sheet listing.?

You will not require to have any formulas in the testing sheet for this to function.

If it has any ongoing potential then we may need to discus the best way to code for 50 sheets?

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Integer, x As String
'if not valid date entry column then ignore
If Not (Target.Column = 7 Or Target.Column = 18) Then Exit Sub
'check that entry row is valid
Select Case Target.Row
        Case Is < 16, Is > 34, 25, 26, 27    ' then is not a valid entry row
        Exit Sub  'not valid so ignore
        
        Case Is < 25 'is required training entry
        'set c to be the column for the class in question
        c = Target.Row - (14 + (Target.Column = 18) * 9)
        
        If Target.Cells(1, 1).Value > "" Then x = "X" 'if date cell has value
        Case Is > 27 'is Elective Training entry
         'check if there are at least 2 Elective trainings complete
        If WorksheetFunction.CountA(Range("G28:H34")) + WorksheetFunction.CountA(Range("R28:S34")) > 1 Then
            c = 19 'always column S
            x = "X"
            Else
            c = 19 'Column S
            s = "" 'not X since too few classes complete
        End If
       
   End Select
       
   On Error Resume Next   'ignore any error message if name not found
 'match name in row r
r = WorksheetFunction.Match(Range("D6"), Sheets("Testing Sheet").Range("A1:A100"), 0)
'If there was no match r will be 0
If r = 0 Then
    MsgBox "Cannot find matching name in Testing Sheet.  Please check and try again."
    Target.Select
    On Error GoTo 0  'reset error default
    Exit Sub
End If
'Enter  x in Testing Sheet
Beep
Sheets("Testing Sheet").Cells(r, c) = x  '**** Rename sheet if required ***
On Error GoTo 0  'reset error default
       
End Sub

AutoTraining2.xlsm
ABCDEFGHIJKLMNOPQRS
1NameRqd-1Rqd-2Rqd-3Rqd-4Rqd-5Rqd-6Rqd-7Rqd-8Rqd-9Rqd-10Rqd-11Rqd-12Rqd-13Rqd-14Rqd-15Rqd-16Rqd-17Elective
2Member 1
3Member 2
4Member 3
5Member 4
6Sam FiremanXXX
7Member 6
8Member 7
9Member 8
10Member 9
11John DoeXXXX
12Member 11
13Member 12
14Member 13
15Member 14
16Member 15
17Member 16
18Member 17
Testing Sheet


AutoTraining2.xlsm
ABCDEFGHIJKLMNOPQRSTUVWX
1
2
3
4
5
6Name:John Doe
7
8
9
10
11
12
13
14Required
15TopicDateInstructorTopicDateInstructor
16Rqd-1Rqd-10
17Rqd-2Rqd-111/1/23
18Rqd-3Rqd-12
19Rqd-4Rqd-13
20Rqd-5Rqd-14
21Rqd-61/1/23Rqd-15
22Rqd-7Rqd-16
23Rqd-8Rqd-171/1/23
24Rqd-91/1/23
25
26Elective (Needs 2)
27TopicDateInstructorTopicDateInstructor
28Elect-1Elect-8
29Elect-2Elect-9
30Elect-3Elect-101/1/23
31Elect-4Elect-11
32Elect-5Elect-12
33Elect-6Elect-13
34Elect-7Elect-14
35
Doe John


AutoTraining2.xlsm
ABCDEFGHIJKLMNOPQRSTUV
1
2
3
41/1/23
5
6Name:Sam Fireman
7
8
9
10
11
12
13
14Required
15TopicDateInstructorTopicDateInstructor
16Rqd-11/1/23Rqd-10
17Rqd-2Rqd-11
18Rqd-3Rqd-12
19Rqd-4Rqd-131/1/23
20Rqd-5Rqd-14
21Rqd-6Rqd-15
22Rqd-7Rqd-16
23Rqd-8Rqd-17
24Rqd-9
253
26Elective (Needs 2)3
27TopicDateInstructorTopic3DateInstructor
28Elect-11/1/23Elect-8
29Elect-2Elect-9
30Elect-3Elect-10
31Elect-4Elect-11
32Elect-5Elect-121/1/23
33Elect-6Elect-13
34Elect-7Elect-14
35
Fireman Sam
 
Upvote 0
@David Clark Below you will find code that may or not be of value.
Also are my testing sheets. You can test using these or maybe on a backed-up copy of a couple of your own sheets.
Copy the code. Open the vba editor and double click on the test member sheet (s). Post the code into the sheet's code pane.

The code should then auto-run as and when there is a change in the sheet, and reflect any added or removed dates with X's in the 'Testing Sheet'.
As it is stands, It assumes the name in the member sheet can be found in the Testing Sheet listing.?

You will not require to have any formulas in the testing sheet for this to function.

If it has any ongoing potential then we may need to discus the best way to code for 50 sheets?

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Integer, x As String
'if not valid date entry column then ignore
If Not (Target.Column = 7 Or Target.Column = 18) Then Exit Sub
'check that entry row is valid
Select Case Target.Row
        Case Is < 16, Is > 34, 25, 26, 27    ' then is not a valid entry row
        Exit Sub  'not valid so ignore
       
        Case Is < 25 'is required training entry
        'set c to be the column for the class in question
        c = Target.Row - (14 + (Target.Column = 18) * 9)
       
        If Target.Cells(1, 1).Value > "" Then x = "X" 'if date cell has value
        Case Is > 27 'is Elective Training entry
         'check if there are at least 2 Elective trainings complete
        If WorksheetFunction.CountA(Range("G28:H34")) + WorksheetFunction.CountA(Range("R28:S34")) > 1 Then
            c = 19 'always column S
            x = "X"
            Else
            c = 19 'Column S
            s = "" 'not X since too few classes complete
        End If
      
   End Select
      
   On Error Resume Next   'ignore any error message if name not found
 'match name in row r
r = WorksheetFunction.Match(Range("D6"), Sheets("Testing Sheet").Range("A1:A100"), 0)
'If there was no match r will be 0
If r = 0 Then
    MsgBox "Cannot find matching name in Testing Sheet.  Please check and try again."
    Target.Select
    On Error GoTo 0  'reset error default
    Exit Sub
End If
'Enter  x in Testing Sheet
Beep
Sheets("Testing Sheet").Cells(r, c) = x  '**** Rename sheet if required ***
On Error GoTo 0  'reset error default
      
End Sub


Thanks for the help with this even though Im a little slow responding.

I added VBA to my excel file, Opened Visual Basic and then double clicked on the name of the testing sheet and added the formula you provided to it. It did not do anything, I then looked at your test sheets and made sure that the spelling for the sheet name, the name listed in column A and the name listed inside the sheet all matched. That still did not mark any changes on the "testing" sheet. I then noticed that the name in the sheet you provided is listed in Row 6 Column Dm however on my sheets it is also merged from D through O. I un merged it in one of the sheets and it also did not do anything. So as a lets see if I loaded on the wrong sheet, I then went to each individual sheet and added the formula you provided. Also there was no change to the "Testing" sheet.

Attached is a photo of one of the sheets used (the one for myself) The sheets are named the same as the name on the sheet, Also is a photo of the Testing sheet. That sheet is named Testing but can be changed to anything if needed.
 

Attachments

  • Members sheet..png
    Members sheet..png
    68.4 KB · Views: 5
  • Testing Snip sheet.png
    Testing Snip sheet.png
    36.2 KB · Views: 7
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
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