Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to change multiple cell comment properties? numbersjim Excel Discussion (Misc queries) 1 February 25th 10 07:44 PM
change control properties according to a cell value Billums Excel Worksheet Functions 1 March 23rd 06 11:15 AM
Change Cell properties by Function Gilles P (FR) Excel Worksheet Functions 2 January 31st 06 12:26 PM
Change active cell properties with command button Nick Excel Programming 2 January 30th 04 05:11 PM
Change active cell properties with command button Beto[_3_] Excel Programming 0 January 30th 04 04:58 PM


All times are GMT +1. The time now is 02:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"