I have created macro code that copies the value of the value in "L2" which works but my problem is if the value of "L2" has a special character it gives me an error. I know the rule that special character is not allowed in renaming a sheet.
Is there a way to bypassed it? say it copies the text from (L2) except the special character? Thank you.
Sub Test()
Range("L2").Select
Selection.Copy
Sheets("Sheet3").Select
Sheets("Sheet3").Name = Range("L2")
Below is the code I have that launched tables from the "pivot" sheet and need to rename them based from the value in Range ("L2").
Range("B2").Select
Selection.ShowDetail = True
Cells.Select
Selection.RowHeight = 15
Range("L2").Select
Selection.Copy
Sheets("Sheet3").Select
Sheets("Sheet3").Name = Range("L2")
Sheets("pivot").Select
Range("B3").Select
Selection.ShowDetail = True
Cells.Select
Selection.RowHeight = 15
Range("L2").Select
Selection.Copy
Sheets("Sheet4").Select
Sheets("Sheet4").Name = Range("L2")
Sheets("pivot").Select
Range("B4").Select
Selection.ShowDetail = True
Cells.Select
Selection.RowHeight = 15
Range("L2").Select
Selection.Copy
Sheets("Sheet5").Select
Sheets("Sheet5").Name = Range("L2")
Sheets("pivot").Select
Range("B5").Select
Selection.ShowDetail = True
Cells.Select
Selection.RowHeight = 15
Range("L2").Select
Selection.Copy
Sheets("Sheet6").Select
Sheets("Sheet6").Name = Range("L2")
Sheets("pivot").Select
Range("B6").Select
Selection.ShowDetail = True
Cells.Select
Selection.RowHeight = 15
Range("L2").Select
Selection.Copy
Sheets("Sheet7").Select
Sheets("Sheet7").Name = Range("L2")
Sheets("pivot").Select
Range("B7").Select
Selection.ShowDetail = True
Cells.Select
Selection.RowHeight = 15
Range("L2").Select
Selection.Copy
Sheets("Sheet9").Select
Sheets("Sheet9").Name = Range("L2")
Sheets("pivot").Select
Range("B8").Select
Selection.ShowDetail = True
Cells.Select
Selection.RowHeight = 15
Range("L2").Select
Selection.Copy
Sheets("Sheet10").Select
Sheets("Sheet10").Name = Range("L2")
Sheets("pivot").Select
Range("B9").Select
Selection.ShowDetail = True
Cells.Select
Selection.RowHeight = 15
Range("L2").Select
Selection.Copy
Sheets("Sheet11").Select
Sheets("Sheet11").Name = Range("L2")
Sheets("pivot").Select
Range("B10").Select
Selection.ShowDetail = True
Cells.Select
Selection.RowHeight = 15
Range("L2").Select
Selection.Copy
Sheets("Sheet12").Select
Sheets("Sheet12").Name = Range("L2")
Sheets("pivot").Select
Range("B11").Select
Selection.ShowDetail = True
Cells.Select
Selection.RowHeight = 15
Range("L2").Select
Selection.Copy
Sheets("Sheet13").Select
Sheets("Sheet13").Name = Range("L2")
Range("L2").Select
End Sub