Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

macros

ResolvedVersion 365

David has attended:
Excel Advanced course

Macros

I download a document every day, the content varies but the header row is the same. I have created 9 or 10 separate macros to change certain parts of the header row, add new columns format the sheet and include formulas where necessary. I would now like to combine the macros so that one click does everything at once. I did try google but I cannot see my macros in VBA. I'm stumped

RE: Macros

Hi David,

Thank you for the forum question.

You will need to write a VBA code to do what you want.

In the visual basic editor in Excel in the module where your macros are stored, click under the last macro (under the line End Sub) and type

Sub RunAll and press Enter. This will give you:

Sub RunAll()

End Sub

Between RunAll() an the line End Sub type the name of the macros in the order you want to execute them. If you for example have macros with the name ChangeHeader, FormatText, AddColumns, the code should look like this


Sub RunAll()
ChangeHeader
FormatText
AddColumns

End Sub

Then by running the RunAll macro you will run all the macros listed inside the RunAll macro.

I hope this makes sense.




Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Excel tip:

Paste functions box quickly

If you want to do a formula using the paste functions box press SHIFT + F3.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.