I am definitely a novice when it comes to writing VBA code. Generally, I search for an answer if I can't write it and if I can't find it, post a question with code to this forum. This has worked great, but this time I feel that I need to post the entire spread sheet so the results can be seen in context.
"Primary Filter Beta 3" is designed to download data from the financial site Finviz.com and filter it by sector based on performance. I have tried to label the sections code as best as possible.
The problem is that when the code tries to create a range that has no qualifying stocks it populates the section with the prior range even though it has a different name and different filters.
For example, there are four filters used to create four ranges BullR, BullC, BearR, and BearC (in that order) before the resulting filtered stocks are placed on the respective sector sheets. However, if BearC has no selections it will paste BearR in the spot where BearC should go rather than leave the space blank. (It's a little different than that, but that's the best way I can describe it without looking at the sheet.) As long as at least one stock qualifies for an individual filters, it's fine.
The code loops through the data 8 times; once for each sector running the for four filters for each sector. At the end of each loop I reset the ranges to Nothing (that solved a different problem).
I suspect the problem is in the filter sections. It is the first time I have used the Union method, but logically it seems like what I need. The formatting sections work fine.
Any insights are appreciated. Thanks in advance.