LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Set Range of visible Autofilltered columns VBA?

I have a spreadsheet of 30 columns and 5000 rows. The first row is a label row.

I applied an autofilter (like greater than 20) to one of the columns and am
showing the visible rows that satisfy the autofiltered column. I wish to color
the maximum and minimum values in each of the visible autofiltered columns

The code below takes a very loong time to complete AND it somehow increases the
rows in the spreadsheet to the maximum 65000.

What am I doing wrong?

Thanks for any help.

my code snippet is:
SS = ActiveSheet.Name
Set curwk = Sheets(SS)
With curwk
'Reset All Interior cells to standard color index
.Cells.Select
Selection.Interior.ColorIndex = xlNone
'Cells.Deselect
.Range("A2").Select

For ii = 2 To LastCol
Set rng = .Columns(ii).SpecialCells(xlCellTypeVisible)
MaxVal = Application.Max(rng)
MinVal = Application.Min(rng)
For Each myCell In rng
CellVal = myCell.Value
If IsNumeric(CellVal) = True Then
If CellVal = MaxVal Then myCell.Interior.ColorIndex = 4
If CellVal = MinVal Then myCell.Interior.ColorIndex = 6
End If
Next
Next ii
End With
 
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
Formula for determining if two date columns fall within specific date range Igottabeme Excel Worksheet Functions 2 April 21st 06 02:50 AM
Referencing a range of columns and rows with the IF function Cliff Excel Worksheet Functions 7 April 2nd 06 01:07 AM
Columns FemIce Excel Discussion (Misc queries) 1 September 28th 05 09:29 AM
average of visible cells in a filtered range dave roth Excel Worksheet Functions 5 May 23rd 05 12:56 PM
extract data from a range of cells in rows or columns when a date. Dartyon Excel Worksheet Functions 0 February 24th 05 10:37 PM


All times are GMT +1. The time now is 07:08 PM.

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"