ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating a truncated range- Speed issue (https://www.excelbanter.com/excel-programming/405490-creating-truncated-range-speed-issue.html)

avi

Creating a truncated range- Speed issue
 
Hello,

I try to create a truncated range: the new range shoulsd contain only
values greater than FilterMinValue

The following code does the job but is quite slow. Is there some
fastest way to get the new range?

For Each cell In RangeAddress
If cell.Value = FilterMinValue Then
If rng Is Nothing Then
'initialize rng with first found cell
Set rng = cell
Else
'expand the found range variable
Set rng = xlApp.Union(rng, cell)
End If
End If
Next cell

Thanks a lot
Avi

Dave Peterson

Creating a truncated range- Speed issue
 
Maybe you could apply data|filter|autofilter and filter to show only the values
= filterminvalue. Then you could use specialcells(xlcelltypevisible) to get the range???


avi wrote:

Hello,

I try to create a truncated range: the new range shoulsd contain only
values greater than FilterMinValue

The following code does the job but is quite slow. Is there some
fastest way to get the new range?

For Each cell In RangeAddress
If cell.Value = FilterMinValue Then
If rng Is Nothing Then
'initialize rng with first found cell
Set rng = cell
Else
'expand the found range variable
Set rng = xlApp.Union(rng, cell)
End If
End If
Next cell

Thanks a lot
Avi


--

Dave Peterson


All times are GMT +1. The time now is 09:55 AM.

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