Excel vba Union method duplicates cells that overlap -


i expected following macro display 6 displays 8. understand because union duplicates cells overlap cells b1:b2 in example:

sub a() dim myrange range set myrange = application.union(range("a1:b2"), range("b1:b4")) msgbox myrange.count end sub 

i found solution problem i'm interested know why way union works , if there other way around besides writing new function suggested above link.

yes, union operator more union statement in sql. excel's union operator not return distinct set of cells.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -