Thread: unique range
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default unique range

Didn't realise allkodok is not contiguous. You will need to ignore row 1
when you create allkodok.

BTW, does autofilter work on a non-contiguous range?

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Stefi" wrote in message
...
Sorry Bob, it still doesn't work. I get a hint saying:

allkodok.Offset(1, 0).Resize...<Application-defined or object-defined
error

It seems as if Offset wouldn't work (perhaps because allkodok is NOT a
contiguous range).

Regards,
Stefi

"Bob Phillips" ezt írta:

Set allkodok = allkodok.Offset(1, 0).Resize(allkodok.Rows.Count - 1)


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Stefi" wrote in message
...
Hi All,

I created a unique range with this piece of code:
Dim allkodok As Range, osszsor As Range
darab = Columns("B:B").End(xlDown).Row
Set osszsor = Range("B1:B" & darab)
osszsor.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
Set allkodok = osszsor.SpecialCells(xlVisible)

My problem is that range "allkodok" contains the header row (cell B1)
and
I
want to exclude it. I tried
Set allkodok = allkodok.Offset(1, 0).Resize(allkodok.Count - 1)
but it fails. Please help!

Regards,
Stefi