Any direction would be appreciated
I have a userforum with macros that when a user types in the forum a code (such as "hm952336") and then clicks the add button, it creates a new row on one sheet with the code in Column C of that row, the code that is in column c is also a hyperlink to a newly created sheet in the same workbook.
If zcode.Value <> "" Then
With Sheets("List").Select
Sheets("List").Rows("2:2").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Rows("2:2").EntireRow.AutoFit
Rows("2:2").Select
Range("C2").Value = zcode
Rows("2:2").Select
Selection.Font.Name = "Arial"
Selection.Font.Size = 12
Selection.Font.Bold = False
End With
With Sheets("MCR (BLANK)").Select
Sheets("MCR (BLANK)").Range("E15").Value = zcode.Value 'UL
Sheets("MCR (BLANK)").Copy Before:=Sheets(3)
ActiveSheet.Name = zcode.Value
Sheets("List").Range("C2").Hyperlinks.Add Anchor:=Sheets("List").Range("C2"), Address:="", SubAddress:=zcode.Value & "!A1", TextToDisplay:=zcode.Value
End With
Else
MsgBox "UL Code required"
End If
Sheets("List").Select
End Sub
The issue is if the code has a space or a symbol (such as "hm9522336 hm9522337" or "hm9522336-hm9522338"), no hyperlink is created.
How can I get the macro to create a hyperlink when a space or a symbol is in it.
Here is the file:
Bookmarks