LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Range too complex

Thanks for the suggestion. I've gone down the sorting data first route and
it seems to work fine.

"Dave Peterson" wrote in message
...
.specialcells has trouble if the resulting range has more than 8192 areas.

Maybe you could sort your data first to clump the cells that should be
cleared,
then sort back to the original order.

Or maybe you could go in smaller steps looping 16000 rows at a time. In
the
worst case, you'd grab every other row--or 8000 areas.

Nirmal Singh wrote:

Thanks for the input, guys.

I did try looping through the worksheet as suggested by Gary's Student,
but
it took too long.

I have also tried the resize suggestion, but that still raises the same
error code. I think it must be the number of discrete visible cells that
remain after the autofilter.

Anyway, what I've finally done is insert a formula in a blank column,
selecting the values from column AN that I require. I then paste these
back
into column AN.

Nirmal

"JMB" wrote in message
...
I don't think it likes the intersect method (maybe it does not like the
fact
there are multiple non-contiguous intersection points).
W/SpecialCells,
you
shouldn't need it anyway.

If you don't want to include the first row of the filter range (if they
are
headers):

Sub test()
Dim MyRange As Range

Range("A1").AutoFilter Field:=25, _
Criteria1:="<0", Operator:=xlAnd, Criteria2:="<1"
With ActiveSheet.AutoFilter.Range
.Offset(1, 0).Resize(.Rows.Count - 1, _
.Columns.Count).SpecialCells(xlCellTypeVisible).Cl earContents
End With
If ActiveSheet.AutoFilterMode Then _
ActiveSheet.AutoFilter
End Sub

Otherwise:
Sub test2()

Range("A1").AutoFilter Field:=25, _
Criteria1:="<0", Operator:=xlAnd, Criteria2:="<1"
ActiveSheet.AutoFilter.Range.SpecialCells(xlCellTy peVisible).ClearContents
If ActiveSheet.AutoFilterMode Then _
ActiveSheet.AutoFilter
End Sub

"Nirmal Singh" wrote:

I want to clear the contents of column AN where the corresponding row
in
column Y is not 0 or 1.

I am using the following code

ActiveSheet.Range("A1").Select
Selection.AutoFilter Field:=25, Criteria1:="<0", Operator:=xlAnd,
Criteria2:="<1"
Set myRange = Application.Intersect(ActiveSheet.Range("AN2:AN655 35"),
ActiveSheet.AutoFilter.Range.SpecialCells(xlCellTy peVisible))
myRange.ClearContents

I get an error message "Range is too complex".

How can I resolve this?

Nirmal




--

Dave Peterson



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filtered data range reference is too complex Tony7659 Excel Discussion (Misc queries) 8 April 2nd 23 08:31 PM
complex color fill conditions- if statements or complex formula? lilly8008 Excel Discussion (Misc queries) 1 December 18th 09 04:57 AM
Copy and paste subtotals-complex data range error Teri Excel Discussion (Misc queries) 1 March 6th 09 04:06 PM
data range is too complex. Frank[_5_] Charts and Charting in Excel 1 July 24th 07 12:54 PM
chart data range too complex likes2cook Charts and Charting in Excel 5 December 19th 06 01:20 AM


All times are GMT +1. The time now is 06:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"