K
Ksenija
hi!
I have this code and I want to have it inside a loop. Am I supposed to
somhow empty MyRange and MyRange1 for every loop??
Sheets("Blad3").Select
Columns(1).Select
Dim MyRange As Range, MyRange1 As Range
Set MyRange = ActiveSheet.UsedRange
For Each c In MyRange
If c.Interior.ColorIndex = 40 Then
If c.Interior.Pattern = xlSolid Then
If MyRange1 Is Nothing Then
Set MyRange1 = c
Else
Set MyRange1 = Union(MyRange1, c)
End If
End If
End If
Next
average_färg = WorksheetFunction.Average(MyRange1)
maxvalue_färg = WorksheetFunction.max(MyRange1)
medianvalue_färg = WorksheetFunction.Median(MyRange1)
I have this code and I want to have it inside a loop. Am I supposed to
somhow empty MyRange and MyRange1 for every loop??
Sheets("Blad3").Select
Columns(1).Select
Dim MyRange As Range, MyRange1 As Range
Set MyRange = ActiveSheet.UsedRange
For Each c In MyRange
If c.Interior.ColorIndex = 40 Then
If c.Interior.Pattern = xlSolid Then
If MyRange1 Is Nothing Then
Set MyRange1 = c
Else
Set MyRange1 = Union(MyRange1, c)
End If
End If
End If
Next
average_färg = WorksheetFunction.Average(MyRange1)
maxvalue_färg = WorksheetFunction.max(MyRange1)
medianvalue_färg = WorksheetFunction.Median(MyRange1)