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

Life's simple. You make choices and you don't look back.

Link to post
Share on other sites
  • Solution
Posted (edited)
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

Life's simple. You make choices and you don't look back.

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...