Clearing excess formats

I have recently been getting messages about “too many different cell formats”, particularly when saving  a 2007/10 format file as Excel 97-2003 format.  Some searching revealed that the source of the problem was a bug that caused unused styles to be copied when copying data between different worksheets.

The problem (and resolution) is described at: You receive a “Too many different cell formats” error message in Excel.

This provides a download for an add-in to automatically remove the custom formats: Remove Styles Add-in

and a couple of links with information on the style-copying problem, with a “hot-fix” download to fix it:

2553085 Unused styles are copied from one workbook to another workbook in Excel 2007

2598127 Unused styles are copied from one workbook to another in Excel 2010

I have now run the Remove Styles add-in (once I found the new “Remove Styles” button on the Home tab), and it seems to work as advertised.  I have yet to try the “hot-fix”.

Posted in Excel | Tagged , , | 6 Comments

what Microsoft think VBA is good for …

The front page of Excel for Developers now has a link entitled VBA, which takes you to:

VBA for Excel developers

which has a link entitled When to use VBA and why which says:

There are three principal reasons to consider VBA programming in Office 2010.

Automation & Repetition

VBA is effective and efficient when it comes to repetitive solutions to formatting or correction problems. For example, have you ever changed the style of the paragraph at the top of each page in Word? Have you ever had to reformat multiple tables that were pasted from Excel into a Word document or an Outlook e-mail? Have you ever had to make the same change in multiple Outlook contacts?

If you have a change that you have to make more than ten or twenty times, it may be worth automating it with VBA. If it is a change that you have to do hundreds of times, it certainly is worth considering. Almost any formatting or editing change that you can do by hand, can be done in VBA.

Extensions to User Interaction

There are times when you want to encourage or compel users to interact with the Office 2010 application or document in a particular way that is not part of the standard application. For example, you might want to prompt users to take some particular action when they open, save, or print a document.

Interaction between Office 2010 Applications

Do you need to copy all of your contacts from Outlook 2010 to Word 2010 and then format them in some particular way? Or, do you need to move data from Excel 2010 to a set of PowerPoint 2010 slides? Sometimes simple copy and paste does not do what you want it to do, or it is too slow. You can use VBA programming to interact with the details of two or more Office 2010 applications at the same time and then modify the content in one application based on the content in another.

That’s all very well; certainly those are three things that VBA is good for, but do Microsoft really think that encompasses all the principal things you can do with VBA? What about the ability to greatly extend the maths functionality of Excel with User Defined Functions that can for instance:

What about creating engineering applications that would be cumbersome and very limited if relying entirely on built-in functions on the worksheet, such as:

What about linking to non-office applications such as:

The reason for Microsoft continuing to undersell the versatility, power and convenience of Excel when combined with VBA remains a mystery to me.

Posted in Excel, UDFs, VBA | Tagged , , | 9 Comments

What is VBA good for? …

… is the name of a Stackoverflow thread that sends a steady trickle of visitors here (thanks to a link posted by Charles Williams of FastExcel).  On a similar theme, Smurf on Spreadsheets has a post entitled “What’s so good about VBA?” that has just celebrated its fifth birthday, and has also recently attracted a comment reading “don’t learn VBA”, which links to a blog post entitled “Losing touch… or why Excel and VBA won’t cut it any more“.

Since all these discussions have generated many comments that are at best misleading and often outright wrong, I thought I would add my perspective.

The first comment from Stackoverflow says that VBA is a “legacy language”. No, it isn’t.  A legacy language is one that has been superseded by others which provide better functionality, but is still used because applications written in the old language are still in use.  This isn’t the case with VBA.  Spreadsheets remain by far the most common application for number processing of all types, Excel remains by far the most widely used spreadsheet, and VBA is the only language tightly bound into the Excel object model, that allows both expert and non-expert programmers (and those in between) to greatly extend the scope and power of Excel with the minimum of fuss.

Further down the page at Stackoverflow there are some good comments about the sort of thing that VBA is good for, but my favourite summary was from Harlan Grove at the Smurf discussion:

Poor analogy, trowel vs backhoe.

Better analogy would be people who use a pickup truck for their job and choose to maintain the truck’s engine themselves. VBA is a 1958 Ford engine for which you need a full set of socket wrenches and maybe a hammer. VSTO is a 2009 Ford engine for which you need a year’s pay to buy all the electronic diagnostic gear.

If you use the additional stuff for the 2009 Ford, your engine will run more efficiently. But if your day job isn’t being a mechanic, is it worth the time & effort learning to use it?

Actually this is where my analogy breaks down. VSTO solutions even when used well aren’t necessarily more efficient than pure VBA. And the analogy breaks down further because truck engines are a lot more standardized than the different .Net versions.

So that’s what VBA is good for.  It’s the ute of computer programs (a ute is a pick-up truck, for non-Australians).  It might not always be the best vehicle for the job (although often it is), but it gets the job done, and you don’t need a special licence to drive it.

What do you think?  Is Excel+VBA still worth learning, or has it had its day?

Posted in Computing - general, Excel, VBA | Tagged , , , | 16 Comments

Bridges Over the Tiber -3

See Bridges Over the Tiber -1 for location map.

The final installment of Bridges Over the Tiber brings us to the six bridges built in the 20 th Century, which can be grouped in three pairs: two copies of the ancient Ponte Fabricio, two based on the medieval and 19th Century arch bridges, and two of clearly 20th Century design.

The Ponte Sublicio (1) – 1918, and Ponte  Amedeo Savoia Aosta (9) 1939 both make clear reference to the ancient Ponte Fabricio.  The Ponte Sublicio is on the site of the earliest bridge over the Tiber, built around 642 BC, but there are now no remains of the original bridge.

Ponte Sublicio

Ponte Sublicio

Ponte Sublicio

Ponte Sublicio

IMG_5862

Ponte Sublicio

The Ponte Amedeo Savoia Aosta was constructed between 1939 and 1942 and consists of three segmental masonry arches covered in white marble.

IMG_5931 IMG_5943 IMG_5944

The Ponte Mazzini (8)  and Ponte Matteotti (16) were constructed in 1904 and 1929 respectively.  The Ponte Mazzini, with three flat segmental arches supported on solid piers, follows in the tradition of the late 19th century bridges, such as the Ponte Vittoria Emanuele II and the Ponte Umberto I.

IMG_5922

Ponte Mazzini

IMG_5923

Ponte Mazzini

IMG_5926

Ponte Mazzini

The Ponte Matteotti with its circular openings either side of the central span and semi-circular arches reflects the design of the medeival Ponte Sisto, although to my mind a good deal less elegantly.

Ponte Matteotti

Ponte Matteotti

IMG_6010

Ponte Matteotti

IMG_6024

Ponte Matteotti

The final two bridges are the Ponte Risorgimento (17) and the Ponte Pietro Nenni (15).  The Ponte Risorgimento has many visual similarities to flat segmental arches of the late 19th Century, but it is an early example of the use of reinforced concrete, having been constructed using the system of François Hennebique, starting in 1909.  The designers have taken advantage of the reinforced concrete system with a larger span and more slender crown than could be achieved with masonry construction.

IMG_6012

Ponte Risorgimento

IMG_6015

Ponte Risorgimento

IMG_6017

Ponte Risorgimento

IMG_6020

Ponte Risorgimento

The Ponte Pietro Nenni was constructed between 1969 and 1972 and is the only modern design of the 17 structures.  Constructed in post-tensioned concrete, the slender slab deck supported on Y shaped piers is totally different to the older arch structures, but the attention to detail has in my opinion resulted in a design that is in keeping with its older neighbours.

IMG_6027

IMG_6001 IMG_6002 IMG_6003

Posted in Arch structures, Historic Bridges, Newton | Tagged , , , | Leave a comment

Using Frame4 for truss analysis

The Frame4 spreadsheet is set up to allow the analysias of rigid-jointed 2D frames, but it is simple to use it for 2D truss analysis; simply either provide a moment release at each end of every member, or define every member with a second moment of area (I) sufficiently low that all bending moments will be negligible.  I have added a truss example to the download zip file.  The program has also had a minor upgrade to Ver 3.06.  Free download (including open source code) from Frame4.zip.

The truss example is taken from: http://richardson.eng.ua.edu/Former_Courses/CE_331_fa00/Notes/Truss_Design_Example.pdf

Truss Example - note that truss height should be 6 feet

Truss Example – note that truss height should be 6 feet

The truss may either be specified with moment end releases at both ends of each member:

Truss2-3a

Or specify a very low I value for each member:

Truss2-3

The results given in the example are shown below:

Truss2-2

The axial load values from the spreadsheet are in good agreement:

Truss2-4

Truss deflected shape:

Truss2-5

Axial force in top and bottom chords:

Truss2-6

Posted in Excel, Finite Element Analysis, Frame Analysis, Newton, VBA | Tagged , , , | 2 Comments