Copy Contents from one worksheet to another

Kizinti

New Member
Joined
Nov 30, 2005
Messages
43
Greetings, first timer so be gentle,
I have a spread sheet that uses a worksheet_change macro. I would like to either create a second macro, or in the same macro when the changes are implimented, copy the contents on the row that was changed (A-J) onto the last available line of an "ARCHIVE" page (i.e. a change tracker page).

The attempts I have tried so far capies the contents 607 times??? What am I doing wrong? Any suggestions.

Thanks,
Kizinti
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Kizinti

New Member
Joined
Nov 30, 2005
Messages
43
To all,
I figured out the problem. In the Worksheet_Change Macro, I make changes to target cells. What I did not realise that whenever a change was made in the target range specified, the macro is called. Thus I was making chages, the macro was making changes, that called itself, etc, etc, etc.

A simple boolean flag that said, "if blnflag = True Then Exit Sub" fixed it. In the Macro, blnFlag was set to True while it was running, until the end where it was set back to False.

All I can say is "DOH!" <SMACK>
 
Upvote 0

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686
If that's the case, all you need to use is Application.EnableEvents=False at the beginning of the code and then set it to True at the end :)
 
Upvote 0

Kizinti

New Member
Joined
Nov 30, 2005
Messages
43
I did try that, but for some reeason my chages where not being done. When I put in the boolean flag, The changes were made, but the copy was done only once. Thanks though
 
Upvote 0

Forum statistics

Threads
1,195,624
Messages
6,010,750
Members
441,568
Latest member
abbyabby

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
Top