Why won't additional worksheets be added when running multiple tabs.

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I had this code slightly tweaked to make sure my symbols (to launch macros) are not included when I copy a sheet within the workbook. I am doing this as I'm working on filtering.

This modified code works with ease. However, as soon as I put in in a "Run all" macro it does not copy the workbook and rename it. I know it works perfect for it does when it is by itself.
The code is:
VBA Code:
Sub SURFACE_PHT()
Application.ScreenUpdating = False
    Application.CopyObjectsWithCells = False
    Set ws = Sheets("PHT")
    ws.Copy After:=Sheets("PHT AIR")
   Sheets(Sheets("PHT AIR").Index + 1).Name = "PHT SURFACE"
   Application.CopyObjectsWithCells = True
    Application.ScreenUpdating = True
End Sub

I have three of therse , and the clear button works- I just have to confirm I want to delete the worksheet before I can delete the next one.


Thank you,
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I don't understand what you are asking for exactly.

The code you posted is designed to copy just the sheet named 'PHT". Are you wanting it to copy other sheets also? Any sheets that you don't want copied? If there are other sheets that you want copied, what do you want the copy to named? etc.

Please clarify exactly what you are wanting to do.

Edit: Perhaps post the code that you are trying to use that doesn't work as you want it to work.
 
Upvote 0
I don't understand what you are asking for exactly.

The code you posted is designed to copy just the sheet named 'PHT". Are you wanting it to copy other sheets also? Any sheets that you don't want copied? If there are other sheets that you want copied, what do you want the copy to named? etc.

Please clarify exactly what you are wanting to do.

Edit: Perhaps post the code that you are trying to use that doesn't work as you want it to work.
Exactly, I have one worksheet "PHT". The Macro above adds another work sheet. If I go to the developer then VBA and press F5 it adds the additional worksheet and names it. However, if I include it in a Run All. There are about 10 Macros ahead of these. Unfortunately, the Run All stops at the last Macro before the three Macros I request to copy the Worksheet.

Thank you for your patience.

Add Worksheet.JPG
 
Upvote 0
You still haven't clarified for me what exactly occurs or doesn't occur. You said all stops. What causes it to stop? What line #? What error #? etc
 
Upvote 0
Unfortunately I get no error- I will continue to try to figure why the macro doesn’t want to run. Sorry I thought I explained the additional worksheet will not be added to the workbook. Thank you
 
Upvote 0
If you put a message box between each of those Calls, you will be able to see where it stops running.
 
Upvote 0
Solution
If you put a message box between each of those Calls, you will be able to see where it stops running.
I figured it out. There was one other macro that was causing the problem. I have it resolved. I didn't use the message box thing, I just used a apostrophe infront of the tiles until I was able to identify the problem. Thank you for making help myself.
 
Upvote 0
Glad it's sorted & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,244
Members
448,879
Latest member
VanGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top