ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Difference operator in Excel VBA (https://www.excelbanter.com/excel-programming/340574-difference-operator-excel-vba.html)

londono001

Difference operator in Excel VBA
 
Hi all,
Does anyone knows where I can find a function that would returns me the
difference of two range. VBA provides with Union and intersection but no
Difference.
Help is much appreciated here
Thanks


Bob Phillips[_6_]

Difference operator in Excel VBA
 
'-----------------------------------------------------------------
Function AntiUnion(SetRange As Range, UsedRange As Range) As Range
'-----------------------------------------------------------------
Dim saveSet
saveSet = SetRange.Formula
SetRange.ClearContents
UsedRange = 0
Set AntiUnion = SetRange.SpecialCells(xlCellTypeBlanks)
SetRange = saveSet
End Function

--
HTH

Bob Phillips

"londono001" wrote in message
...
Hi all,
Does anyone knows where I can find a function that would returns me the
difference of two range. VBA provides with Union and intersection but no
Difference.
Help is much appreciated here
Thanks





All times are GMT +1. The time now is 05:17 PM.

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