ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Filter a column & Indent all but the 1st header record (https://www.excelbanter.com/excel-programming/436983-how-filter-column-indent-all-but-1st-header-record.html)

Bud

How to Filter a column & Indent all but the 1st header record
 
Hello

I am filtering on column 1 6 times and than indenting column 3 a specific
number of times depending on the criteria in column 1. Ex. If the criteria is
1 than I indent 2 times and ifthe criteria is I indent 4 times.

I have supplied the code I am using below. It works fine except for
indenting row 1 all the time.

The issue is that I don't want row 1 ever indented and the way I have the
code it is getting indented.

How can I use the attached code and just not select row 1 on the
indent.....as I want all rows it filtered to be indented except row 1.

Thanks

'Filter on Column 1 the Outline level field and Indent Column 3 Task name
Selection.AutoFilter Field:=1, Criteria1:="2"
Range("C:C").Select
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.AutoFilter Field:=1, Criteria1:="3"
Range("C:C").Select
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.InsertIndent 1

Tom Hutchins

How to Filter a column & Indent all but the 1st header record
 
Try

Selection.AutoFilter Field:=1, Criteria1:="2"
Range("C2:C" & Range("C" & Rows.Count).End(xlUp).Row).Select
Selection.InsertIndent 4
Selection.AutoFilter Field:=1, Criteria1:="3"
Range("C2:C" & Range("C" & Rows.Count).End(xlUp).Row).Select
Selection.InsertIndent 6

Hope this helps,

Hutch

"Bud" wrote:

Hello

I am filtering on column 1 6 times and than indenting column 3 a specific
number of times depending on the criteria in column 1. Ex. If the criteria is
1 than I indent 2 times and ifthe criteria is I indent 4 times.

I have supplied the code I am using below. It works fine except for
indenting row 1 all the time.

The issue is that I don't want row 1 ever indented and the way I have the
code it is getting indented.

How can I use the attached code and just not select row 1 on the
indent.....as I want all rows it filtered to be indented except row 1.

Thanks

'Filter on Column 1 the Outline level field and Indent Column 3 Task name
Selection.AutoFilter Field:=1, Criteria1:="2"
Range("C:C").Select
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.AutoFilter Field:=1, Criteria1:="3"
Range("C:C").Select
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.InsertIndent 1
Selection.InsertIndent 1



All times are GMT +1. The time now is 02:46 AM.

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