Jump to content

Highlighting Filtred Data Only - Exclude Header


Go to solution Solved by SkysLastChance,

Recommended Posts

$oExcel.ActiveSheet.AutoFilter.Range.Rows.Columns(30).SpecialCells($xlCellTypeVisible).Interior.ColorIndex = 37
$oExcel.ActiveSheet.AutoFilter.Range.Rows.Columns(30).SpecialCells($xlCellTypeVisible).Value = 0

I have a script that is filtering a range of data using the code above. 

I am using this to highlight and change the value to 0 in column 30 (AD)  (Filtred Data Only)

However, I don't want to include the header. What would be the a good/clean way to exclude the header row?

Otherwise, I am just planning to re-fill in the header row in with _Excel_Rangewrite. 

 

Edited by SkysLastChance
Spelling

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Link to comment
Share on other sites

  • Solution
Local $xlup = -4162
$LastRow = $oWorkbook.ActiveSheet.Range("A1000000").End($xlup).Row

$oExcel.ActiveSheet.AutoFilter.Range.Rows("2:" & $LastRow).Columns(30).SpecialCells($xlCellTypeVisible).Interior.ColorIndex = 37
$oExcel.ActiveSheet.AutoFilter.Range.Rows("2:" & $LastRow).Columns(30).SpecialCells($xlCellTypeVisible).Value = 0

This seemed to do the trick. 

Edited by SkysLastChance

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...