Ger
09-07-2011, 01:14 AM
Hey,
I'm trying to build a macro that colors x-rows depending on a value on sheet ("wk 27 tm 52") cells I312 to GH312.
In the macro i first remove the background color (sub ontkleuren). Then the macro (sub kleuren) must set the background color for x-rows in column a depending on the value on sheet ("wk 27 tm 52" cell I312), x-rows in column B depending on value ("wk 27 tm 52" cell J312) etc.
Sub kleurtjes()
ontkleuren
kleuren
End Sub
Sub ontkleuren()
Dim j As Long, z As Long, x As Long
Sheets("in dienst").Select
Application.ScreenUpdating = False
For j = 1 To 182
z = 4
x = 50
Range(Cells(z, j), Cells(x, j)).Select
With Selection.Interior
.ColorIndex = xlNone
End With
Next j
End Sub
Sub kleuren()
Dim j As Long, z As Long, x As Long
Sheets("in dienst").Select
For j = 1 To 182
z = 4
x = z + the value on sheet (wk 27 tm 52 cell I312 to GH312
Range(Cells(z, j), Cells(x, j)).Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Next j
Application.ScreenUpdating = True
End Sub
Ger
I'm trying to build a macro that colors x-rows depending on a value on sheet ("wk 27 tm 52") cells I312 to GH312.
In the macro i first remove the background color (sub ontkleuren). Then the macro (sub kleuren) must set the background color for x-rows in column a depending on the value on sheet ("wk 27 tm 52" cell I312), x-rows in column B depending on value ("wk 27 tm 52" cell J312) etc.
Sub kleurtjes()
ontkleuren
kleuren
End Sub
Sub ontkleuren()
Dim j As Long, z As Long, x As Long
Sheets("in dienst").Select
Application.ScreenUpdating = False
For j = 1 To 182
z = 4
x = 50
Range(Cells(z, j), Cells(x, j)).Select
With Selection.Interior
.ColorIndex = xlNone
End With
Next j
End Sub
Sub kleuren()
Dim j As Long, z As Long, x As Long
Sheets("in dienst").Select
For j = 1 To 182
z = 4
x = z + the value on sheet (wk 27 tm 52 cell I312 to GH312
Range(Cells(z, j), Cells(x, j)).Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Next j
Application.ScreenUpdating = True
End Sub
Ger