Hi
I am trying to create a new sheet and then rename other sheet with unique name, how can I do that? or can i check the names and then when I name a sheet to for example 1, I want excel to search for this name in all sheets and if it is there then either change the name of the new one to something else or change the other one. Thank you very much.
I am trying to create a new sheet and then rename other sheet with unique name, how can I do that? or can i check the names and then when I name a sheet to for example 1, I want excel to search for this name in all sheets and if it is there then either change the name of the new one to something else or change the other one. Thank you very much.
Code:
Sub abcd()
' adding sheet then rename the reset
Worksheets.Add before:=Worksheets(1)
Dim x As Integer
Dim y As Integer
x = Worksheets.Count
For y = 1 To x
Worksheets(y).Name = y
Worksheets(y).Tab.ColorIndex = y + 4
Next y
End Sub
Last edited: