Need help with Macro's format shading

M

Madhart

I'm trying to set up some shading macro's or rules for an excel page (excel
2003) and running into a little difficulty. I set up a macro to put in a
light shading to make everything easy on the eyes every even number row:
Range( _
"A8:S8,A10:S10,A12:S12,[through],A94:S94" _
).Select
With Selection.Interior
.ColorIndex = 24
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Range("G4:M4").Select
End Sub
I also created one to remove the shading.

however, I also have a macro to add a mandatory and needed shading of:
With Selection.Interior
.ColorIndex = 2
.Pattern = xlLightUp
.PatternColorIndex = xlAutomatic
End With
End Sub
This shading will be in random cells and change day by day but needs to stay.

I also have some printing macros that I hope will bennifit from your answers.

My question is: Is there any way to create an exception or something so
that if there are any cells that have the .ColorIndex = 2/.Pattern =
xlLightUp shading in
them then the other shadings/or removal won't overwrite them but instead
leave them and continue filling in the rest of the cells?

Thanks :)
 
B

bhicks11 via AccessMonster.com

Sorry Madhart - you posted an Excel question to an Access forum. You'll have
better success posting to an Excel forum.

Bonnie
http://www.dataplus-svc.com
I'm trying to set up some shading macro's or rules for an excel page (excel
2003) and running into a little difficulty. I set up a macro to put in a
light shading to make everything easy on the eyes every even number row:
Range( _
"A8:S8,A10:S10,A12:S12,[through],A94:S94" _
).Select
With Selection.Interior
.ColorIndex = 24
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Range("G4:M4").Select
End Sub
I also created one to remove the shading.

however, I also have a macro to add a mandatory and needed shading of:
With Selection.Interior
.ColorIndex = 2
.Pattern = xlLightUp
.PatternColorIndex = xlAutomatic
End With
End Sub
This shading will be in random cells and change day by day but needs to stay.

I also have some printing macros that I hope will bennifit from your answers.

My question is: Is there any way to create an exception or something so
that if there are any cells that have the .ColorIndex = 2/.Pattern =
xlLightUp shading in
them then the other shadings/or removal won't overwrite them but instead
leave them and continue filling in the rest of the cells?

Thanks :)
 
M

Madhart

Thanks :)

bhicks11 via AccessMonster.com said:
Sorry Madhart - you posted an Excel question to an Access forum. You'll have
better success posting to an Excel forum.

Bonnie
http://www.dataplus-svc.com
I'm trying to set up some shading macro's or rules for an excel page (excel
2003) and running into a little difficulty. I set up a macro to put in a
light shading to make everything easy on the eyes every even number row:
Range( _
"A8:S8,A10:S10,A12:S12,[through],A94:S94" _
).Select
With Selection.Interior
.ColorIndex = 24
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Range("G4:M4").Select
End Sub
I also created one to remove the shading.

however, I also have a macro to add a mandatory and needed shading of:
With Selection.Interior
.ColorIndex = 2
.Pattern = xlLightUp
.PatternColorIndex = xlAutomatic
End With
End Sub
This shading will be in random cells and change day by day but needs to stay.

I also have some printing macros that I hope will bennifit from your answers.

My question is: Is there any way to create an exception or something so
that if there are any cells that have the .ColorIndex = 2/.Pattern =
xlLightUp shading in
them then the other shadings/or removal won't overwrite them but instead
leave them and continue filling in the rest of the cells?

Thanks :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top