general question about macro behaviour

tomekm

New Member
Joined
Mar 31, 2017
Messages
9
Hi,

If I create a macro and run it on a file (script would entail some vlookups to repository files, text-to-columns, etc.), do I have to re-run that macro every time I add information to the existing file and save it (added information with the same format, column names, etc.), or can I program the macro so that it applies the changes to all the cells in a tab automatically, regardless if there's info on them or not yet.

Thanks.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi tomekm

Your macro is a program that runs and does something, when it stops, it's gone.

It may have written out information to workbooks or worksheets and that will remain.

If what remains is OK you don't need to run your macro again. If it needs updating, you run the macro again.

When in doubt, you run the macro again.

Yes, you can make changes to all the cells in a tab (worksheet) even if there is nothing in the cells, and you can have the macro run automatically when the workbook is opened ([FONT=&quot]Sub Auto_Open() )[/FONT].

I hope that helps,
Regards
Alan
 
Upvote 0
Macros can be written to be run manually or automatically. There is a lot of flexibility there.
They can be set to run automatically upon a variety of events, like opening a workbook, closing it, switching sheet, selecting a cell, updating cells, etc.
Chip Pearson did a good write-up on these "event" procedures. Here is a link: Events In Excel VBA
 
Upvote 0

Forum statistics

Threads
1,215,344
Messages
6,124,407
Members
449,157
Latest member
mytux

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