ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   I'm loving Interse (https://www.excelbanter.com/excel-discussion-misc-queries/447715-im-loving-interse.html)

Phil Hibbs

I'm loving Interse
 
I really like the Intersect function. I use it a lot, for instance if my VBA wants to process every row that the user has selected:

Set ProcessRange = Intersect( ActiveSheet.UsedRange, Selection.EntireRow, Cells(1,1).EntireColumn )

It also removed duplciate selected cells. ProcessRange.Count tells me how many rows are selected.

Any time you process a set of selected cells, Intersect( Selection, ActiveSheet.UsedRange ) will remove thousands of redundant cells that you don't need to process.

Phil.


All times are GMT +1. The time now is 04:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com