asddsaasddas
Board Regular
- Joined
- Mar 23, 2020
- Messages
- 60
- Office Version
- 2016
- 2013
- Platform
- Windows
I have a macro that takes the rows of value in A. What this macro does is that it will create a new sheet with the cell value as its name. For example, column A is populated with values Cat, Dog and Mouse respectively in rows 1,2 and 3. The problem that i face is, if i have a already existing sheet with the name "Cat", "Dog" or "Mouse" an error will be prompted. Is it possible to not duplicate sheets with the same name?
This is my current VBA code for reference.
VBA Code:
Sub Split_projects()
Dim Splitcode As Range
Sheets("zzMAIN").Select
Set Projects = Range("Projects")
For Each Cell In Projects
Sheets("zTEMPLATE").Copy After:=Worksheets(Sheets.Count)
ActiveSheet.Name = Cell.Value
Next Cell
End Sub
This is my current VBA code for reference.