Ladies & Gentlemen,
I have borrowed some code from David McRichie's site (see below). The code creates a new worksheet based upon a name (in my case a Stock ticker) entered into a column, It also ignores duplicates and places the stock symbol in cell 1A of the newly created sheet.
I can get it to run fine when I manually enter a symbol in the target column, but I need it to work via a copy / paste using a list of stock symbols. Again, it works fine if I copy just one, but it causes an error when I try and copy a list. Also, how can I get this code to copy a customized template(from within the same workbook) and not just add a sheet?
All the Best!
Gregg
Private Sub Worksheet_Change(ByVal Target As Range)
Dim newSht As String, oldSht As String
Dim wsOld As Worksheet, wsNew As Worksheet
If Target.Column <> 1 Or Target.Row = 6 Then Exit Sub
oldSht = ActiveSheet.Name
Set wsNew = ActiveSheet
newSht = Target.Text
On Error Resume Next
Sheets(newSht).Activate
If Err.Number = 0 Then 'sheetname already exists
Sheets(oldSht).Activate
Exit Sub
End If
On Error Resume Next
'Create New Sheet
Sheets.Add After:=Sheets(Sheets.Count) '-- place at end
ActiveSheet.Name = newSht
Set wsNew = ActiveSheet
wsNew.Cells(1, 1) = "'" & newSht 'name of new sheet into cell
' Sheets(Sheets.Count).Activate 'try to show last tab
Sheets(oldSht).Activate
End Sub
Bookmarks