Hidden column cells - data being added but formatting not applied

tomleitch

Board Regular
Joined
Jan 3, 2012
Messages
185
Hi all,

I have the following code which is supposed to add "N/A" to cells and colour them in green:


Code:
If ch = vbOK Then            Target.Cells.Interior.ColorIndex = 43
            Range(Cells(Target.Row, twelvewl + 1), Cells(Target.Row, twelvewr)) = "N/A"
            Range(Cells(Target.Row, twelvewl), Cells(Target.Row, twelvewr)).Interior.ColorIndex = 43
            Range(Cells(Target.Row, sixwl + 1), Cells(Target.Row, sixwr)) = "N/A"
            Range(Cells(Target.Row, sixwl), Cells(Target.Row, sixwr)).Interior.ColorIndex = 43
            Range(Cells(Target.Row, twowl + 1), Cells(Target.Row, twowr)) = "N/A"
            Range(Cells(Target.Row, twowl), Cells(Target.Row, twowr)).Interior.ColorIndex = 43
            Else: Target.Cells.Value = ""
            End If
Some columns in the range are hidden and it is adding the "N/A" to the hidden columns but it isn't colouring them in.

Any ideas?


Thanks
Tom
 

Some videos you may like

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Watch MrExcel Video

Forum statistics

Threads
1,099,064
Messages
5,466,375
Members
406,478
Latest member
Amar kumar

This Week's Hot Topics

Top