Worksheet_Change DEAD

Peltz

Board Regular
Joined
Aug 30, 2011
Messages
87
Hello. I'm new to macros, so im sorry if this is a silly question.

I have a macro:

Rich (BB code):
Sub Oppdatering()
Dim i As Long
Dim Status As String
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Status = Sheets("Status").Range("D7").Value
Sheets("HK-oppfølging").Select
For i = 4 To 204 Step 25
If Range("D" & i) = Status Then
Sheets("HK-oppfølging").Range("A" & i - 2 & ":G" & i + 22).Copy Destination:=Sheets("Status").Range("B11:H35")
End If
Next i
Sheets("Status").Select
End Sub

This macro is placed in a module I've called "Oppdatering" and is working perfectly as long as i call it with a button. However, when i try to call it from the Sheet folder using Private Sub Worksheet_Change(ByVal Target As Range), Excel turns dead!
Here is the code

Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$7" Then
Call Oppdatering
End Sub

The code in the Sheet (Yes, I've now put it inn all Sheets just to make sure its working in the right sheet:)) The Cell "D7" in the Status Sheet is a drop down menu. I have allso had different Worksheet_SelectionChange codes that suddenly stopped working in different Workbooks?!

Ive allso tried the dummy


Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
Rich (BB code):
  MsgBox "You just changed " & Target.Address
End Sub

</PRE>... changing away with nothing happening..

Safety is put to low, working in Excel 2003.
What is going on here?

And by the way: How do you post the macros with the slider window?
 
Last edited by a moderator:

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
worksheet_change is a special event trapped by excel, you have disabled it in your code

you need to remove this line, also create a small macro with .eventsenable to get it all running again
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top