Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Has anyone written a good, fast function that takes two range arguments,
and returns a range variable equal to the first range excluding the intersection of the first and second ranges. The function I have written is very basic and slow. I would be very interested if there is a faster version of this function. Thanks in advance. Public Function RangeExclusion(FromRange As Excel.Range, ExcludeRange As Excel.Range) As Excel.Range Dim rngCell As Excel.Range, rngAnswer As Excel.Range If ExcludeRange Is Nothing Then Set RangeExclusion = FromRange Exit Function ElseIf FromRange Is Nothing Then Set RangeExclusion = Nothing Exit Function End If For Each rngCell In FromRange If Application.Intersect(rngCell, ExcludeRange) Is Nothing Then If rngAnswer Is Nothing Then Set rngAnswer = rngCell Else Set rngAnswer = Union(rngAnswer, rngCell) End If End If Next Set RangeExclusion = rngAnswer ' Clean up. Set rngCell = Nothing Set rngAnswer = Nothing End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Data Validation/Lookup function does function correcty | Excel Worksheet Functions | |||
copy of excel file not showing formulal/function in the function b | Excel Discussion (Misc queries) | |||
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) | Excel Worksheet Functions | |||
Adding a custom function to the default excel function list | Excel Programming | |||
User-Defined Function pre-empting Built-in Function? How to undo???? | Excel Programming |