CtrlAltRage
New Member
- Joined
- Aug 23, 2022
- Messages
- 12
- Office Version
- 365
- Platform
- Windows
I have a spreadsheet that creates new sheets when a new value is entered in the first sheet. It then make the value that was entered in the first sheet clickable so when I select it - it automatically takes me to the newly created sheet.
For some reason - the only way I can get it to work is if I do not use spaces for the values I enter in.
Otherwise I get this prompt:
The script is below:
Any and all advice would be greatly appreciated, thanks!
For some reason - the only way I can get it to work is if I do not use spaces for the values I enter in.
Otherwise I get this prompt:
The script is below:
VBA Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns(1)) Is Nothing Or Target.Count > 1 Or IsEmpty(Target) Then Exit Sub
If Not Evaluate("=ISREF(" & Target.Value & "!A1)") Then
Sheets("Project Template").Copy after:=Sheets("PROJECTS")
ActiveSheet.Name = Target.Value
ActiveSheet.[A1] = ActiveSheet.Name
End If
Me.Activate
Target.Offset(, 2).Formula = "=" & Target.Value & "!D1"
Target.Offset(, 3).Formula = "=" & Target.Value & "!G13"
End Sub
'ADDED
'--------------------------------------------------------------------
Private Sub Worksheet_selectionChange(ByVal Target As Range)
If Intersect(Target, Columns(1)) Is Nothing Or Target.Count > 1 Or IsEmpty(Target) Then Exit Sub
If Not Evaluate("=ISREF(" & Target.Value & "!A1)") Then Exit Sub
Sheets(Target.Value).Activate
End Sub
Any and all advice would be greatly appreciated, thanks!