Code not working - what is wrong.

Brutusar

Board Regular
Joined
Nov 23, 2019
Messages
166
Office Version
  1. 365
Platform
  1. Windows
Hi, I am using the code below to start a different Sub when the value of cell A1 in the active sheet is changed. However, the code is not working, meaning nothing is happening. The sub that is supposed to be started when the value is changed is working fine when run directly. I can't find my mistake in the code, but it must be something?


VBA Code:
 Sub Worksheet_Change(ByVal Target As Range)

    If Target.Address = "$A$1" Then
    
        Call CopyAndAppendRange
    End If
    
End Sub
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Is there any chance of sharing your file via Google Drive, Dropbox or similar file-sharing platform?
 
Upvote 0
If you run it as below, do you get the message box after every change:
VBA Code:
 Sub Worksheet_Change(ByVal Target As Range)

    If Target.Address = "$A$1" Then
        MsgBox "Yes"
    End If
    
End Sub
 
Upvote 0
I would have it call a simple little modular code like this and see if it works.

Msgbox "Hello"
 
Upvote 0
Also, make sure that the CopyAndAppendRange sub is in a standard module and not with the WorksheetChange code.
 
Upvote 0
I see here you're attempting to copy the values from the same sheet with the change event code:
Set wsCopy = ActiveSheet
 
Upvote 0
Show us all the things you have in the sheet change event script sheet.
Maybe you have more code there.
 
Upvote 0
If you run it as below, do you get the message box after every change:
VBA Code:
 Sub Worksheet_Change(ByVal Target As Range)

    If Target.Address = "$A$1" Then
        MsgBox "Yes"
    End If
   
End Sub
Nope, no message box popping up
 
Upvote 0

Forum statistics

Threads
1,215,110
Messages
6,123,146
Members
449,098
Latest member
Doanvanhieu

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