Hi,
This code needs to go faster. Does anyone know how?
Thank!!
Please Login or Register to view this content.
Hi,
This code needs to go faster. Does anyone know how?
Thank!!
Please Login or Register to view this content.
Administrative Note:
Welcome to the forum.
We would very much like to help you with your query, however you need to include code tags around your code.
Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.
Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
I did it for you this time. Please read forum rules. Thanks
Hi G,
Unfortunately the following statement is slow for everyone, just not for you:
The code will probably run faster if instead of hiding one row at a time:Please Login or Register to view this content.
a. Make all rows visible
b. Create a range of rows that will be hidden, and hide the range of rows
In addition, you probably want to disable and enable Excel Events before and after the code runs:
You may also want to do the same for ScreenUpdating.Please Login or Register to view this content.
Lewis
Maybe, just maybe, if you explain in a concise manner what you want to achieve, someone will come up with a code that is not as mixed up (dim statements all over the place comes to mind) and probably will be considerable faster.
Everybody has their own way of doing things.
Er zijn vele wegen die naar rome leiden.
An attachment is always a great help also so people don't have to build a workbook themselves to test their handywork.
Last edited by jolivanes; 04-01-2020 at 05:44 PM.
This is where the code is slow. You are looping through each row one cell at a time.
You do not need to use a loop here.Please Login or Register to view this content.
1. Enter a formula in an empty column to return a 1 if the row needs to be hidden.
2. Use Goto Select Special to select all the 1's in your column
3. Useto hide your RowsPlease Login or Register to view this content.
4. Clear the 1's from your column.
So you can complete the task in about 4 steps.
If you have 100000 rows then your existing solution takes 500, 000 steps.
My General Rules if you want my help. Not aimed at any person in particular:
1. Please Make Requests not demands, none of us get paid here.
2. Check back on your post regularly. I will not return to a post after 4 days.
If it is not important to you then it definitely is not important to me.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks