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

  • Thread starter Thread starter Bud
  • Start date Start date
B

Bud

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
 
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
 
Back
Top