Hey, Greg.
Sorry it's been awhile. I did get the cleaner version of your macro via
email. It's great. A couple of things I wasn't clear on, though.
Rather than inserting text for column counts and the percentage, these need
to be a field codes. (Subsequent adding or deleting to the list is why. Then
use Ctrl+F9 to update the fields).
Second, rather than the macro running on all the tables in the document, I
want it to run on the one my cursor is in. The scenario is that I paste a
2-column table, then put the cursor at the top of the first column and run
the macro. For example, here's a simple freshly pasted table (the table has
2 columns and 3 rows):
Unit1 Unit1
Unit3 Unit2
Unit3
So then I put my cursor in the upper left cell and run the macro which:
1. Adds a row above
2. Inserts a field code in each column header that counts the Units below.
3. Adds another row above.
4. Inserts a field code that calculates the percentage of column A to column
B.
The result is this (the table has 2 columns and 5 rows):
67%
2 3
Unit1 Unit1
Unit3 Unit2
Unit3
What I'm after may not be possible with field codes in all three spots--cell
A2 in particular, because there is a blank cell in the column, so I may have
to live with text inserted instead of a field code for that one. The rest is
doable, right?
Brad H.
|