Recognize a pattern, then take an action

TedX

Board Regular
Joined
Apr 18, 2021
Messages
122
Office Version
  1. 365
Platform
  1. Windows
Howdy Friends, one of you will know how to do this instantly, most will scratch their head and end up in the "Stumped" mob, where I currently sit. As you can, I have a snippet of a worksheet showing and it has two horse races that follow a similar pattern. That pattern is as follows.

Race 1 always starts at "A6"
Columns C to R are always hidden.
At random, horses are hidden such as Row 22 and Row 31.
There is always the Race number followed by an empty row, followed by the time of the race, followed by an empty row, followed by the headings, "Tab", "Horse", etc.
These 5 rows are the patterns, Rows 6,7,8,9,10 and again for rows 26, 27, 28, 29, 30. There could be as many as 12 races on a day, and the number of horses changes in every race.

I want to either delete or hide the 2 empty rows in each pattern at the top of every race, so that the visible rows become 6, 8,10 and 26, 28, 30.

1672531110580.png


So the image above is how my race page currently looks and I would dearly love to have a macro that I could simply click, that would go from the top of the page down through each race, hiding or deleting the unwanted empty rows, so it would look similar to the example shown below.

1672533889710.png


Please keep in mind that there is a randomness to my pages in that the number of races changes daily and the number of horses per race also changes..... BUT ........ The pattern described above, never changes. First person with the solution is a genius.... Go!!!!!! 😂 :ROFLMAO:
 
I had forgotten about that choice. I'm now assuming that the code would not be run unless at least one race existed so have removed the check that the first 'Find' actually found something. For deleting the rows the adaptation of my method would be ..

Ahhh if you read above, I never got to the delete based on the hide working perfectly, but it's great for anyone in the future reading this in a similar scenario, that you changed it, once again, great work (y)
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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