Macro Help - check existing tabs

  • Thread starter Thread starter Macro Help
  • Start date Start date
M

Macro Help

I have a macro that takes data from an existing tab,
creates a new tab called "Final", and does some
formatting stuff with it. An improvement I want to make
is to have the macro check the workbook at the beginning
to see if it already has an existing "Final" tab, and if
so, prompt the user whether to delete the existing tab or
quit the macro. How do I make this work?

Thank you
 
Dim oSheet As Worksheet

On Error Resume Next
Set oSheet = Worksheets("Sheet1")
On Error GoTo 0
If oSheet Is Nothing Then
Worksheets.Add.Name = "Sheet1"
End If
 

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