ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheet change event and list validation question (https://www.excelbanter.com/excel-programming/314257-sheet-change-event-list-validation-question.html)

nick

Sheet change event and list validation question
 
The following is my code. The Target cell is a list validation. When I type
in the word hide in cell(any row, column 6), the cell in column 7 of the same
row interior pattern changed. But when i use the list validation to change
the value of the cell, the cell interior pattern did not change. I put a
breakpoint to see if the code ran and it did but line 4 of the code did not
do anything.

1 Private Sub Worksheet_Change(ByVal Target As Range)
2 If Target.Column = 6 Then
3 If Ucase$(Trim$(Target.Text)) = "HIDE" Then
4 Cells(Target.Row, 7).Interior.Pattern = xlDown
5 End If
6 End If
7 End Sub

Tom Ogilvy

Sheet change event and list validation question
 
If you are using Excel 97, the change event is not fired when a selection is
made from a Data Validation dropdown list that uses a range to populate the
list. I would expect this to work in xl2000 or later.

--
Regards,
Tom Ogilvy

"Nick" wrote in message
...
The following is my code. The Target cell is a list validation. When I

type
in the word hide in cell(any row, column 6), the cell in column 7 of the

same
row interior pattern changed. But when i use the list validation to

change
the value of the cell, the cell interior pattern did not change. I put a
breakpoint to see if the code ran and it did but line 4 of the code did

not
do anything.

1 Private Sub Worksheet_Change(ByVal Target As Range)
2 If Target.Column = 6 Then
3 If Ucase$(Trim$(Target.Text)) = "HIDE" Then
4 Cells(Target.Row, 7).Interior.Pattern = xlDown
5 End If
6 End If
7 End Sub





All times are GMT +1. The time now is 12:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com