ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   unique range (https://www.excelbanter.com/excel-programming/379675-unique-range.html)

Stefi

unique range
 
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


Bob Phillips

unique range
 
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




Stefi

unique range
 
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





Bob Phillips

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







Mike Fogleman

unique range
 
Set osszsor = Range("B2:B" & darab) 'ignore B1

Mike F

"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








All times are GMT +1. The time now is 03:31 PM.

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