View Single Post
 
Old 05-09-2020, 11:36 AM
BobBridges's Avatar
BobBridges BobBridges is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

You need to paste the code into a VBA module. How you do that may vary a bit with the version of Excel you're using, but try this:

1) Enable the "Developer" tab. This is hidden by default, but if you're going to start doing anything in VBA you'll want it visible. If you don't see it up at the top of your Excel window along with File, Home, Insert, etc, turn it on this way:

1a) Go to File, Options.
1b) Select Customize Ribbon in the left panel.
1c) On the right side of the dialogue, check the box labeled "Developer".
1d) Click on OK and return to normal Excel operation. You should now see the Developer option in your ribbon.

2) Click on Developer, then select Visual Basic (at the far left).

This opens the VBA Editor. You may need some time and experimentation to find your way around here, but in the Project (sub-)window you'll see a list of your open workbooks, and the worksheets in each.

3) Right-click in the project window anywhere on the workbook where you want to save the code.

4) Select "Insert", then "Module".

A new module appears. Paste your code in there.

Starting with Excel 2007 (I think), when you save the workbook after that, Excel will complain that you'll lose that code if you save it as .xlsx; you'll have to save it as .xlsm to keep the VBA code. And when it comes to running that program, maybe you'll need help with that too. But enough to start with...I hope :-).

Reply With Quote