Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Visual Basic suddenly stopped working

I have this visual basic code in my spreadsheet.

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address = "$G$10" Then _
Target.Offset(, 2) = Target.Offset(, -2) * Target * (-1)
If Target.Address = "$I$2" Then _
Target.Offset(, -2) = Target / Target.Offset(, -4) * (-1)
Application.EnableEvents = True

If Target.Row < 2 Then Exit Sub
Application.EnableEvents = False
If Target.Column = 7 Then _
Target.Offset(, 2) = Target.Offset(, -2) * Target * (-1)
If Target.Column = 9 Then _
Target.Offset(, -2) = Target / Target.Offset(, -4) * (-1)
Application.EnableEvents = True
End Sub

It worked fine, but suddenly it stopped.
How can I make it work again?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Visual Basic suddenly stopped working

assuming the code was working fine before, I would guess your code stopped
half through and left .EnableEvents=False.
In the immediate window run
Application.EnableEvents = True
and see if the event fires.

NickHK

"amirstal" wrote in message
oups.com...
I have this visual basic code in my spreadsheet.

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address = "$G$10" Then _
Target.Offset(, 2) = Target.Offset(, -2) * Target * (-1)
If Target.Address = "$I$2" Then _
Target.Offset(, -2) = Target / Target.Offset(, -4) * (-1)
Application.EnableEvents = True

If Target.Row < 2 Then Exit Sub
Application.EnableEvents = False
If Target.Column = 7 Then _
Target.Offset(, 2) = Target.Offset(, -2) * Target * (-1)
If Target.Column = 9 Then _
Target.Offset(, -2) = Target / Target.Offset(, -4) * (-1)
Application.EnableEvents = True
End Sub

It worked fine, but suddenly it stopped.
How can I make it work again?



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
Histogram function suddenly stopped working Allisonnl09 Excel Discussion (Misc queries) 2 December 17th 08 04:17 AM
Visual Basic code not working when sheet is saved joe123 Excel Discussion (Misc queries) 3 October 22nd 08 01:50 PM
Data Validation In-Cell Dropdown has Suddenly Stopped being Displa Brett Fish Excel Worksheet Functions 3 April 6th 07 06:32 PM
Excel 2000 suddenly stopped letting me enter data. Help? usatutoring Excel Discussion (Misc queries) 1 April 25th 06 11:44 AM
Can I run Visual Basic procedure using Excel Visual Basic editor? john.jacobs71[_2_] Excel Programming 3 December 26th 05 02:22 PM


All times are GMT +1. The time now is 03:27 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"