vendredi 27 mars 2015

VBA Cell Format Error

I'm trying to format a group of cells using a for loop (later a conditional while loop)


I'm getting the error '1004'


Method 'Range' of object "Global' failed


I can't figure out how to convert the cells value to a range value that doesn't throw this error. The Cells(x,y) by itself throws an error as well


Thanks in advance



For row = 2 To 5

With Range(Cells(row, 5)).Interior
.Pattern = xlPatternRectangularGradient
.Gradient.RectangleLeft = 0.5
.Gradient.RectangleRight = 0.5
.Gradient.RectangleTop = 0.5
.Gradient.RectangleBottom = 0.5
.Gradient.ColorStops.Clear
End With
With Range(Cells(row, 5)).Interior.Gradient.ColorStops.Add(0)
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
With Range(Cells(row, 5)).Interior.Gradient.ColorStops.Add(1)
.ThemeColor = xlThemeColorAccent6
.TintAndShade = -0.250984221930601
End With

Next row

Aucun commentaire:

Enregistrer un commentaire