Help With Worksheet Change Code

Dazzawm

Well-known Member
Joined
Jan 24, 2011
Messages
3,816
Office Version
  1. 365
Platform
  1. Windows
I have the code below that when I enter a number into a cell in column AE on sheet 1 it changes to what is the corresponding number in column A on sheet 2 to what is next to it in column B on sheet 2. It works fine but if I select multiple cells at once and paste nothing happens, is there a slight tweak that will overcome this please?

Code:
Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
    If Not Intersect(Target, Range("AE:AE")) Is Nothing Then
        Application.EnableEvents = False
        If IsNumeric(Application.Match(Target.Value, Sheets("Sheet2").Columns("A"), 0)) Then
            Target.Value = Application.VLookup(Target, Sheets("Sheet2").Range("A:B"), 2, 0)
        End If
        Application.EnableEvents = True
    End If
End Sub
 
But it must have something to do with this code. The before close code has worked forever with no issues!
 
Upvote 0
You may want to turn off events in beforeclose. Share your beforeclose code, perhaps we can spot the issue.
 
Upvote 0
You may want to turn off events in beforeclose. Share your beforeclose code, perhaps we can spot the issue.
I will just remove this code before closing, that seems to be the problem. Closes ok when I do that.
 
Upvote 0

Forum statistics

Threads
1,226,847
Messages
6,193,314
Members
453,790
Latest member
yassinosnoo1

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