Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Is it possible to just act on the filtered data

Hi, I'm using Excel 2010 and I have a question about filtered data and
performing an operation on just the filtered data. In the code below I
have two filters running. Then I have the code moving down the column
turning text red when certain criteria are met. The problem is that it
is doing it on **all** the data in the YOS column and I only want it
to do it on the filtered data. Is there a way to adjust my code so
that it only operates on filtered data? Thanks.

'Set Region filter to NA and sets Work Location Data filter to all US
locations
Selection.AutoFilter Field:=11, Criteria1:="NA"
Selection.AutoFilter Field:=10
'Formats text in YOS column to red if = 1
finalrow = Cells(200, 1).End(xlUp).Row
For i = 2 To finalrow
If Cells(i, 13).Value = 1 Then
Cells(i, 13).Font.Color = -16776961
End If
Next i
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Is it possible to just act on the filtered data

On Jan 10, 8:32*am, John Menken wrote:
Hi, I'm using Excel 2010 and I have a question about filtered data and
performing an operation on just the filtered data. In the code below I
have two filters running. Then I have the code moving down the column
turning text red when certain criteria are met. The problem is that it
is doing it on **all** the data in the YOS column and I only want it
to do it on the filtered data. Is there a way to adjust my code so
that it only operates on filtered data? Thanks.

'Set Region filter to NA and sets Work Location Data filter to all US
locations
* * Selection.AutoFilter Field:=11, Criteria1:="NA"
* * Selection.AutoFilter Field:=10
* * 'Formats text in YOS column to red if = 1
* * * * finalrow = Cells(200, 1).End(xlUp).Row
* * * * For i = 2 To finalrow
* * * * If Cells(i, 13).Value = 1 Then
* * * * * * Cells(i, 13).Font.Color = -16776961
* * * * End If
* * * * Next i


Just ALSO filter by the value for column 13 and then use
..specialcells(xlcelltypevisible).font
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Is it possible to just act on the filtered data

Thanks. I took your suggestion and it works fine except for one little
thing.
The code below also formats the titles (row 1) in red. Is there any
way to modify the code below so that it ignores the titles?
Thanks for all your help.

....
'Set Region filter to NA and sets Work Location Data filter to all US
locations
'also sets an auto filter to YOS column
Selection.AutoFilter Field:=11, Criteria1:="NA"
Selection.AutoFilter Field:=10
Selection.AutoFilter Field:=13, Criteria1:="=1"
'Formats rows to red

With Selection.SpecialCells(xlCellTypeVisible)
.Font.Color = -16776961
End With


'removes AutoFilter
Selection.AutoFilter

....





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return filtered values into report worksheet based on filtered valueon the data worksheet dicko1 Excel Worksheet Functions 1 April 21st 09 12:27 AM
Filtered Data Hardeep_kanwar[_2_] Excel Discussion (Misc queries) 2 January 10th 09 03:22 PM
MS2007 - deleting filtered data, deletes non-visible data too Nita Excel Discussion (Misc queries) 1 December 9th 08 03:42 PM
Filter data and fill only filtered data Thad Meyers[_2_] Excel Discussion (Misc queries) 1 August 30th 07 06:26 PM
Help to sort out filtered data from the data contained in another sheet of the same workbook No News Excel Worksheet Functions 1 July 28th 06 04:04 PM


All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"