mistersend
New Member
- Joined
- May 29, 2020
- Messages
- 15
- Office Version
- 2019
- Platform
- Windows
I have a list of 4 (ACTUALLY 80, but simplified) students on Sheet1. I have made 4 sheets, 1 sheet for each student. I want to rename these 4 sheets on the basis of the name in the list, so that whenever I update the name list, the corresponding sheet-name changed automatically, without going to that sheet or manually running the macro again and again. I already have the following code in the workbook to hide the sheet which are not in use:
Private Sub Worksheet_Change(ByVal Target As Range)
If [A1] = "" Then
Sheet2.Visible = False
Else
Sheet2.Visible = True
End If
If [A2] = "" Then
Sheet3.Visible = False
Else
Sheet3.Visible = True
End If
If [A3] = "" Then
Sheet4.Visible = False
Else
Sheet4.Visible = True
End If
End Sub
I have the following code which can rename the sheet but only 1 sheet, not all:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Set Target = Sheet1.Range("B2")
If Target = "" Then Exit Sub
Sheet2.Name = Left(Target, 31)
Exit Sub
End Sub
I don't know how to apply both the code simultaneously.
Please help, if anyone have any solution.
Private Sub Worksheet_Change(ByVal Target As Range)
If [A1] = "" Then
Sheet2.Visible = False
Else
Sheet2.Visible = True
End If
If [A2] = "" Then
Sheet3.Visible = False
Else
Sheet3.Visible = True
End If
If [A3] = "" Then
Sheet4.Visible = False
Else
Sheet4.Visible = True
End If
End Sub
I have the following code which can rename the sheet but only 1 sheet, not all:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Set Target = Sheet1.Range("B2")
If Target = "" Then Exit Sub
Sheet2.Name = Left(Target, 31)
Exit Sub
End Sub
I don't know how to apply both the code simultaneously.
Please help, if anyone have any solution.