LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Worksheet_Change function

I am attempting to Conditionally format a range of cells (named "OUMcol") to
either 0 or 1 decimal place, depending on the value in a cell named
"Programme". Following earlier advice, I have implemented a
Worksheet_Change() function, as below. Cell "Programme" uses Data
validation to implement a drop down list.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = Range("Programme").Address Then
Application.EnableEvents = False
If Range("Programme").Value = "Edexcel" Then
Range("OUMcol").NumberFormat = "0"
'MsgBox "Edexcel"
Else
Range("OUMcol").NumberFormat = "0.0"
'MsgBox "Not"
End If
Application.EnableEvents = True
End If
End Sub

In a simple test spreadsheet all works fine. Selecting "Edexcel" from the
list formats the range to 0dp, any other to 1 dp.

However, in my 'real', rather complex spreadsheet, it only works if I type
the value into the cell. Selecting from the list does not work. I thought
at first that selecting the value from the list failed to trigger the Change
event, but not so. If I include the MsgBox statements above, the
appropriate message is printed, but the cells are not formatted.

Summary:
if I type the value into the cell "Programme", the message is printed and
the cells are reformatted.
If I select the value from a list, the message is printed but the cells are
NOT reformatted.
in a trivial version of the spreadsheet, it all works fine, in either case.

Can anyone suggest what is going on, please?


 
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
Getting around Worksheet_Change() mtowle Excel Worksheet Functions 1 October 20th 05 06:05 PM
Problem with function "Worksheet_Change" konpego Excel Worksheet Functions 0 June 23rd 05 05:46 AM
Can an add-in macro update a worksheets Worksheet_Change function? strataguru Excel Programming 1 October 4th 03 07:06 PM
worksheet_change vs. calculate, and worksheet_change not running Tom Ogilvy Excel Programming 1 July 14th 03 02:51 AM
worksheet_change vs. calculate, and worksheet_change not running Ross[_5_] Excel Programming 0 July 13th 03 04:27 PM


All times are GMT +1. The time now is 08:00 PM.

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"