LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
Rob Manger
 
Posts: n/a
Default Running of Worksheet Change Macro breaks undo functionality.

Hi all,

I have a problem, using code from this forum (from David McRitchie,
thanx Dave) I have created a Conditional formatting macro in my
worksheet change event macro. This works a treat, apart from one issue
that the users of the spreadsheet have complained about. 'Undo
Functionality' it seems that the undo functionality of any worksheet
with this macro is broken. I have heard there is no way around it.
Any ideas? Any help would be hugely appreciated. NOTE: This is in
Excel 2003 SP2, if that helps

Find below the macro I am using.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errorhandler
Dim cRange As Range
Dim cell As Range
Dim icolor As Integer
Dim target2 As String

'***************** check range ****
Set cRange = Intersect(Range(ActiveWorkbook.Names("status")),
Range(Target(1).Address))
If cRange Is Nothing Then Exit Sub
'**********************************

For Each cell In Target
If cell = "N/A" Then
icolor = 38
Else
target2 = Left(cell, 1)
Select Case target2
Case "f"
icolor = 3
Case "p"
icolor = 4
Case "b"
icolor = 46
Case "-"
icolor = 36
Case Else
icolor = 2
End Select
End If
Application.EnableEvents = False 'should be part of
Change macro
cell.Interior.ColorIndex = icolor
Application.EnableEvents = True 'should be part of Change
macro


Next cell

Exit Sub
errorhandler:
icolor = 0
Target.Interior.ColorIndex = icolor
End Sub

 
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
Add protect worksheet password in macro Kelly Excel Worksheet Functions 1 January 10th 06 02:08 AM
Need help updating my macro to include a 2nd worksheet. billrl34 Excel Worksheet Functions 0 December 9th 05 08:06 PM
Help with a macro to open to a specific worksheet EAHRENS Excel Worksheet Functions 0 November 30th 05 08:36 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
Where to stick macro to change default comment font? [email protected] Excel Discussion (Misc queries) 1 January 1st 05 12:57 AM


All times are GMT +1. The time now is 03:27 PM.

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

About Us

"It's about Microsoft Excel"