Sunday 11 February 2018

Creating Macro's

I know I have tried to stick to python but sometimes there are things that you want to do in Excel (for example) that you cannot do in python, or at least cannot easily work out. Often in these occasions the best thing to do is to create an Excel Macro to perform the process. As with much of the python a quick Google or a search of stack-overflow will show you exactly how to do what you need to. 

As an example, I had a process (which has since been superseded by creating a zip file so no need for this process) whereby I wanted to create a file and using a macro save it with a password. This was because I could not get XLwings to open as an xlsx and save as an xlsm but a macro can do this easily. 

I have created a post previously on how to actually run a macro using xlwings but here I want to show you how to actually record a macro. In most cases things that you can do with a recorded macro you can replicate in xlwings and it tends to be the more complicated things that cannot be replicated. 

Below is a gif showing how to record a macro.  Note you should go into Excel options and enable the developer tab in order to more easily record, edit and maintain macros. 




No comments:

Post a Comment