VBA, Make a new sheet if it doesn't exist

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Sub Button1_Click()

inset = Range("B3").Value
Sheets.Add
ActiveSheet.Name = "inset"
On Error GoTo Dele
Sheets("sdfs").Select
Range("A2").Select

Dele: ActiveSheet.Delete

End Sub

I'm wanting this button to make a new sheet within the workbook, named as
whatever is in B3 on the same sheet as the button. I only want it to do this
if this sheet does not already exist.

Its for recording productivity, and each sheet will be a person, and I want
part of the code to make a new sheet if that person doesn't already have a
sheet, new staff etc.
 
try this idea from a recent post of mine
Sub mynewsheets()
For Each c In Range("myrange")
On Error Resume Next
If Sheets.Name <> c Then
Sheets.Add.Name = c
End If
Next c
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top