Code to Delete Sheet Tabs

Justinian

Well-known Member
Joined
Aug 9, 2009
Messages
1,557
Office Version
  1. 365
Platform
  1. Windows
I have a code I run to split data into tab named after managers. All managers are together on sheet1 and after I run the code, each manager's data is on its own tab. The problem is the when the code is run again, it adds data on each tab instead of replacing the data on each tab. How can I construct some code so Excel deletes all tabs to the right of my data sheet before running my original code to separate tabs?
 
Try changing

Code:
Application.ScreenUpdating = False

to

Code:
    With Application
        .ScreenUpdating = False
        .Calculation = xlCalculationManual
    End With

and

Code:
Application.ScreenUpdating = True

to

Code:
    With Application
        .ScreenUpdating = True
        .Calculation = xlCalculationAutomatic
    End With

Wow! Now it runs even faster than it ever did before! Thank you!
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Some one please help, the following VBA code is not working, any suggestions to edit the code, Pls let me...
Option
Explicit
Private Sub Worksheet_Activate()
Dim r As Range, c As Range
Set r = Range("a1:a299")
Application.ScreenUpdating = False
For Each c In r
If Len(c.text) = 0 Then
c
.EntireRow.Hidden = True
Else
c
.EntireRow.Hidden = False
End If
Next c
Application.ScreenUpdating = True
End Sub
 
Upvote 0
@renju, Please start a new thread of your own rather than hijack someone else's.

To start a new thread click the post new thread button on the main page.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,230
Messages
6,158,662
Members
451,507
Latest member
aexis48d

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