PDA

View Full Version : Visible cells



Pawel
08-09-2016, 07:47 AM
Hi guys,

I was wondering how do I make macro run only on visible(unhidden) cells?
what should I add to this code:?


With Application.FindFormat.Interior
.PatternColorIndex = xlAutomatic
.Color = 16711935
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=True).Activate

Pawel
08-09-2016, 12:24 PM
This doesn't fix it by the way:( :


Dim cell as Range

For Each cell In ActiveSheet.Cells.SpecialCells(xlCellTypeVisible)
With Application.FindFormat.Interior
.PatternColorIndex = xlAutomatic
.Color = 16711935
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=True).Activate
Next cell
Exit Sub

Pawel
08-10-2016, 12:18 AM
Please help anyone!