Change the properties of a non selected cell?
i have some code which validates a row.. and compares two columns in
the row. The code is triggered from Worksheet_SelectionChange(ByVal Target As Range) within the worksheet. i want to be able to set the colours of the cells if they do not pass validation.. how can i do this with selecting the actual cell? Thanks Vincent |
Change the properties of a non selected cell?
just refer to the cells
target.offset(0,1).Interior.ColorIndex = 5 or cells(Target.row,"F").Interior.ColorIndex = 5 as examples. -- Regards, Tom Ogilvy "Winshent" wrote in message om... i have some code which validates a row.. and compares two columns in the row. The code is triggered from Worksheet_SelectionChange(ByVal Target As Range) within the worksheet. i want to be able to set the colours of the cells if they do not pass validation.. how can i do this with selecting the actual cell? Thanks Vincent |
Change the properties of a non selected cell?
Vincent,
Simply use the range object: If YourCondition = Condition Then Range("H1").Interior.ColorIndex = 3 Else Range("H1").Interior.ColorIndex = xlNone End If HTH, Bernie MS Excel MVP "Winshent" wrote in message om... i have some code which validates a row.. and compares two columns in the row. The code is triggered from Worksheet_SelectionChange(ByVal Target As Range) within the worksheet. i want to be able to set the colours of the cells if they do not pass validation.. how can i do this with selecting the actual cell? Thanks Vincent |
All times are GMT +1. The time now is 08:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com