VBA Script

diana1duff2

New Member
Joined
Mar 11, 2024
Messages
2
Office Version
  1. 365
Can anyone help me figure out how to get my script to work. I have a tracking database that will have an overview sheet and "Team" sheets. I need to figure out how to get all the data from column A-N to copy over to the corresponding Team page based on the number entered into column A. i.e. If the number 1 is entered into column A then the data from column A-N of that row copies over to Team1 sheet. I will need it to go from number 1-4/Team1-Team4 worksheet.

I have a code that does that and updates any cell that may be updated from the Overview page; however, if I run it constantly it continuously adds the information over and over again in the worksheet it goes with. I just need it to copy over anything already in the database, update a cell on both pages if a cell updates, and adds the data to the page it needs to go to if a new row of data is entered.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
I think you're saying your code calls itself repeatedly? Or it makes changes, which triggers an event (e.g. Sheet Change), which makes changes, which triggers Sheet Change, which makes changes,...
You can disable events at the start of the code that runs first, then at the end of the code, enable events. I suggest using an error handler if you do this.
Here's an example
 
Upvote 0
I think you're saying your code calls itself repeatedly? Or it makes changes, which triggers an event (e.g. Sheet Change), which makes changes, which triggers Sheet Change, which makes changes,...
You can disable events at the start of the code that runs first, then at the end of the code, enable events. I suggest using an error handler if you do this.
Here's an example
I have a database with information that each has an "identifying" number that has recently been added to it on the Overview sheet. I have the script that will now run and copy the already inputted data into the "Team" Sheet it belongs to. If I update a cell or add a new row, it runs again. So, where I may have 45 rows of information on sheet Team 1, if any update it made to the Overview Sheet I will now have 90 rows of information on sheet Team 1. I need the code to do an initial call, putting everything on the correct Team sheet, and if an update is done on any data already entered, it will just update that information on the Team sheet it is on, or if a new row of information is entered it will pick up the identifier and then copy that new information to the correct Team page. I hope I am making sense.
 
Upvote 0
OK, but that doesn't reveal what conditions can be checked to prevent that. If you post a wb on a shared drive I may be able to take a look at it.
EDIT - I wanted to send the following to you in a pm but it seems you cannot receive them:

I say maybe because my dear friend of some 20 years died Wednesday and I can be moody and a bit withdrawn these days. I think I will have the patience to take a look, but I may not be able to manage a repeated back and forth for anyone's problem here. It's not just about your thread; it's all of them. I was OK when I posted, figuring it would be a quick answer so I hope that isn't going to be an issue for you. This afternoon is visitation; tomorrow, funeral.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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