Hi everyone,
I'm a teacher and I wanted to create notifications (new sheets based on a template) when a student scores less than 80%.
I have the following event code which will create a new sheet based on my template when a value is entered into a cell. I need two changes:
- Create a sheet when the value is less than 80 (instead of creating a sheet when a value is entered into the cell)
- Naming the sheet the student's name and the name of the test
If anyone can help. Thank you.
'Event code that runs if a cell value is changed
Private Sub Worksheet_Change(ByVal Target As Range)
'Check if the cell value in Column C is < 80
If Not Intersect(Target, Range("C:C")) Is Nothing Then
'Copy worksheet based on value in cell F2 in worksheet Sheet1 and put it last
Sheets(Worksheets("Sheet1").Range("F2").Value).Copy , Sheets(Sheets.Count)
'Rename worksheet to the value you entered.
ActiveSheet.Name = Target.Value
End If
'Go back to worksheet Sheet1
Worksheets("Sheet1").Activate
End Sub
I'm a teacher and I wanted to create notifications (new sheets based on a template) when a student scores less than 80%.
I have the following event code which will create a new sheet based on my template when a value is entered into a cell. I need two changes:
- Create a sheet when the value is less than 80 (instead of creating a sheet when a value is entered into the cell)
- Naming the sheet the student's name and the name of the test
If anyone can help. Thank you.
'Event code that runs if a cell value is changed
Private Sub Worksheet_Change(ByVal Target As Range)
'Check if the cell value in Column C is < 80
If Not Intersect(Target, Range("C:C")) Is Nothing Then
'Copy worksheet based on value in cell F2 in worksheet Sheet1 and put it last
Sheets(Worksheets("Sheet1").Range("F2").Value).Copy , Sheets(Sheets.Count)
'Rename worksheet to the value you entered.
ActiveSheet.Name = Target.Value
End If
'Go back to worksheet Sheet1
Worksheets("Sheet1").Activate
End Sub
Name | English Test | Math Test | |||
Red | 50 | 100 | Template: | Template | |
Orange | 100 | 100 | |||
Yellow | 80 | 90 | |||
Green | 90 | 95 | |||
Blue | 88 | 40 | |||
Purple | 92 | 80 | |||
Brown | 20 | 85 | |||
Black | 80 | 92 | |||
White | 95 | 50 |