Excel – the easiest way to automate Excel tasks


If I need to automate a series a task on an excel sheet like

  • remove all rows where column 3 contains value "asdf"

  • remove column 7 and column 9

  • sort according to column 4


What is the easiest way of automating such tasks in excel? I think it would recording a macro but sometimes macro have to be edited a lot to actually make them work and even then macros stop if the excel sheet has a variation. Editing macro scripts could be a time taking process which becomes inefficient for such tasks. The automation is required since number of excel sheets will be a lot. Can you suggest an easier way ?

Best Solution

As long as, you have the activities defined - Macro is still the better thing to look for.
There could be some things that could change.

Please explain the problem with the help of code.
If you have defined the steps with a few variables, it should be easy to write a macro that wouldn't stop in case of variation.

Please post the code and describe in detail what you would want? which point does it stop, in case of variation? What would you like the code to do?

EDIT: Alternatively, you can write code in VB6/.net (c#/vb.net)/Python for automation.

Related Question