Deactivate worksheet code during paste

swaink

Active Member
Joined
Feb 15, 2002
Messages
432
Hi All
I have code in a worksheet that highlights the entire row when the user selects a cell.

However when I try to paste new data to that sheet using a macro the macro fails because of the active worksheet code.

Is it possible to suspend the worksheet code whilst another macro is running then re activate it on completion?

Many thanks

Kevin :rolleyes:
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi
Yes, you need to put a condition at the beginning of the code such as:
If Range("A1").Value = 77 Then
(rest of code)
End If (add this after your code)

Then it will only be active whilst the value of A1 is 77 (or whatever you choose)

hope this helps
regards
Derek
 
Upvote 0
On 2002-03-22 03:03, swaink wrote:
Hi All
I have code in a worksheet that highlights the entire row when the user selects a cell.

However when I try to paste new data to that sheet using a macro the macro fails because of the active worksheet code.

Is it possible to suspend the worksheet code whilst another macro is running then re activate it on completion?

Many thanks

Kevin :rolleyes:


Application.enableevents=false

then the rest of your code....

application.enableevents=true


ivan
 
Upvote 0

Forum statistics

Threads
1,214,414
Messages
6,119,373
Members
448,888
Latest member
Arle8907

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