I'm trying to use VBA to automatically copy a worksheet (within the same workbook) and then give that worksheet a name dictated by the contents of a cell. I have pulled together some code by searching forums etc but it just ain't working...
Code is:
Dim WsName As String
Sheets("Pt_Type_Query").Range("U3").Select
Do
ActiveCell.Offset(l, 0).Select
With Target
Set WsName = ActiveCell.Value
End With
Sheets("1").Select
Sheets("1").Copy After:=Sheets("1")
ActiveSheet.Name = WsName.Value
l = 1
Loop Until ActiveCell.Value = ""
The line that appears to be causing problems is highlighted in red...
Thanks in advance to anyone who can solve this!
Bookmarks