Easy macro issue (I think)

  • Thread starter Thread starter punter
  • Start date Start date
P

punter

Hi,

I'm new to macros but getting pretty good at them. I put together a
macro that does various pivots. The problem arises after it runs the
first pivot (on which all the other data is eventually dumped). When I
wrote the macro the name of the sheet that opened up was Sheet2. When I
run the macro again I get an error if the sheet that is opened is not
named Sheet2. If it is named Sheet2 then it runs perfectly. Below is
the error I get:

Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Summary"

I assume that I need to put something inside the brackets to tell it to
proceed with whatever name the sheet is given once the pivot is run.
Does anyone know what I should do in this case.

Thanks for the help.

Eddie.
 
Thank you so much for the quick reply. Should I delete the two lines
currently in the macro and replace them with what you have listed
below? Or are they to be added to the two lines in some way?

Thanks

Eddie
 

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