Macro fast on tab 1 but slow on tab 2

Drewbert34

New Member
Joined
Jun 21, 2011
Messages
26
This one has had me beat for awhile now. I have a macro that will run in the blink of an eye on tab 1. On tab 2 the same macro is very slow and appears to lock up Excel for a minute or two until it finishes. No metter the macro it runs faster on the 1st tab than the 2nd. I checked for page breaks and I also disable screen refresh. Any ideas?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
It would help to see the code...

Are there any differences between the two sheets?
One is raw data, other is formulas?
One has more data than the other?
etc...
 
Upvote 0
Try posting the code with a brief outline of what it does.
 
Upvote 0
Sorry guys I went on vacation :cool:

Here is the code:

Sub Jackie2()
'
' Jackie2 Macro
'
'
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim LR As Long
LR = Range("D7").End(xlDown).Row
With Range(Cells(7, 1), Cells(LR, 47))
.Formula = .Value
End With
Cells.FormatConditions.Delete
ActiveWindow.FreezePanes = False
Cells.Select
Range("A300").Activate
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Columns("G:G").Select
Selection.Delete Shift:=xlToLeft
ActiveWorkbook.Worksheets("Commercial Upgrades Projects").AutoFilter.Sort. _
SortFields.Add Key:=Range("E6:E1048576"), SortOn:=xlSortOnValues, Order:= _
xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Commercial Upgrades Projects").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub

I am still new and I'm sure there are better ways to do the operation however it is for work so I don't have much time to improve/test. This macro does everything I need it to do and it runs in the blink of an eye on the 1st tab of my work sheet. On the 2nd tab (the tab the macro is for) it is very slow. The same is true for any other macros I have made....all run very quick on tab 1 but not tab 2.

I cannot find anything that would indicated what is wrong? From all that I can tell the macro itself is not the problem but some formatting of the page?
 
Upvote 0
I just wanted to follow up with this in case anyone else does a search and stumbles on this thread.

The issue with the macros running slow on the 2nd tab of the workbook but not the 1st was due to the 2nd tab had deleted columns outside the range of the macro. The 1st tab appeared to be the same way however it's unused columns were just hidden.

After copying the page to another sheet and making sure everything played nice I hid the uneeded columns and ran the macro which now runs faster than I can blink!

I hope this helps someone :cool:
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

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