PDA

View Full Version : conditional formatting with vba



ashgull80
04-28-2012, 03:16 AM
hi i have a userform that inputs data into a sheet. i would like it to also set a conditional formt that if a check box in a cell is checked it changes the colour of the row that it applies to.
thanks ash

Bob Phillips
04-28-2012, 05:29 AM
Bit sparse on the details Ash, but maybe something like


With ActiveSheet

.Rows("10:20").Interior.ColorIndex = xlColorIndexNone

Select Case True

Case CheckBox1.Value: .Rows(10).Interior.ColorIndex = 3

Case CheckBox2.Value: .Rows(12).Interior.ColorIndex = 4

Case CheckBox3.Value: .Rows(15).Interior.ColorIndex = 5

Case CheckBox4.Value: .Rows(11).Interior.ColorIndex = 6

'etc.
End Select
End With

ashgull80
04-29-2012, 12:04 PM
sorry i didnt make it very clear.
i have a userform that inputs data into a row, i would like column "P" to have conditional format to change the colour off the cells "A" - "P" in the row if column "P" says true.

i would like this applied at the time i inpout the data through the user form not set to every row before he data is input
thanks ash