Quicken a marco

Marc_w90

Board Regular
Joined
Jul 11, 2014
Messages
74
Office Version
  1. 365
Platform
  1. Windows
Hello,
I have this bit of code that I'm using and they its performing really slowly and I'm not sure why or how to improve it.

Code:
Sub Hide_complete2014()
Application.ScreenUpdating = False
Dim cell As Range
For Each cell In Range("N1:N1000")
If (cell.Value) = "Complete" Then
cell.EntireRow.Hidden = True
End If
Next
Application.ScreenUpdating = True
End Sub


All they are doing is sorting a mass load of data the ranges and N1:N1000 could actually do with either being a count or infinitely long if possible while still running quickly.

any ideas?

Thanks
Marc
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
It looks like you just want to hide rows depending on whether column N is equal to "Complete". If that is the case, instead of using VBA and Loops, you can just use Filters.
 
Upvote 0
Sorry I should probably elaborate on the situation.
This is in a sheet where the users are not entirely used to excel and there are other bits of code that do similar things with multiple filters.
 
Upvote 0
You can do Filters in VBA code. Try re-using the Macro Recorder and record yourself applying the filters. That will give you most of the code that you need.
If you have any issues, please post the code you come up with and explain what you need adjusted.
 
Upvote 0
Thanks Joe, that worked a treat. Didn't realise you could record filters.
 
Upvote 0

Forum statistics

Threads
1,214,535
Messages
6,120,090
Members
448,944
Latest member
sharmarick

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