Impossible? Automatic numbering across columns (not in a table)

B

Benjamino5

Hi all,

First, let me give you the context:

I'm creating a template that formats sets of math problems according to
precise specs. Most of the problems are very short and need to be in columns.
The UI is very simple: the user selects a range of text and then chooses a
column number from the Columns menu on my custom toolbar: then the problems
are laid out with the right vertical and horizontal spacing.

To make this work, I had two choices: put the problems into tables, or use
the Columns feature in Word (with continuous section breaks separating
sections with different numbers of columns).

I decided to use section breaks, etc. so that as you added text, it would
reflow from the bottom of one column into the top of the next and the columns
would automatically "balance"--neither of which can be done (easily) with
tables.

Now, the PROBLEM:

It's become apparent that the math problems have to be numbered from left to
right, NOT down each column.

Automatic numbering in Word always goes down columns, because Word sees
multiple columns as a long range of paragraphs that happen to be presented in
an unusual way--it has absolutely no conception of a "row" when you're using
the Columns feature.

So I can't easily get numbering to go from left to right across the columns.
And I really, really need to. It seems I have three options:

1) Switch to tables--but then the authors can't add problems to one column
and have them flow into the next column, nor would the columns auto-balance
their content, as real MS Word columns do.

2) Create many stacked section breaks. This is a little odd, but I think it
could work: if your section has only a single paragraph in each column, the
numbering LOOKS like it's going across instead of down. Say you have 3
problems in 3 columns:
1 2 3

The numbering is fine, even though it's technically going down the columns.

Now, if you had nine problems, you could create THREE one-row sections, each
done in three columns. It would look like this:

1 2 3
_________
4 5 6
__________
7 8 9

So I could create stacked one-row sections to build my columns. This is the
best idea I've got, but it's obviously pretty ugly and error-prone.

3) My third option is something I haven't thought of that perhaps you have. ;)

Anyway, I know this is very long, but I'd love to get your advice. And if
your advice is, "tell the users they can't have automatic numbering across
columns," please don't bother. This isn't negotiable (I've tried).

Thanks a lot!
Ben
 
B

Benjamino5

As a footnote, I realize that option #2 would prevent automatic reflow and
column balancing.

So there doesn't seem to be any easy way of having columns that a) have
automatic numbering across the rows, b) automatically reflow, and c) balance.

Of course, what about the SEQ field--can I use that somehow to make a
customized automatic numbering scheme that would calculate the correct number
for each item??
 
J

Jezebel

Assuming that each 'problem' is something that VBA can recognise, then you
could iterate the problems within each section and use the Information()
function to get the horizontal and vertical position of each. Construct a
2-D array representing the arrangement of the problems on the page, then
number the array elements left to right, top to bottom, and insert those
numbers back into the document itself.

This is a little simplistic in line with your specification: there are all
sorts of possible complications: what do you want to do if a problem in one
column is much longer than its neighbours?

Non-negotiability notwithstanding, it's hard to avoid concluding that you
are in a hole here: are you sure you want to go on digging?
 
R

Russ

Benjamino5,
This subroutine could be used to generate the row numbers needed to label a
single column of math problems before changing to multi-columns. It needs to
know the number of columns and the total number of math problems. There is
no validation of input. You could also put the generated numbers into an
array.

Sub ColumnDown_To_RowAcross_Number_Generator()
' Renumber Single Column before changing to multi-column
Dim lngColumns As Long
Dim lngRow As Long
Dim lngNumberCount As Long
Dim lngNewNumber As Long
Dim lngTotalMathProblems As Long
Dim lngIteration As Long

lngColumns = 3
lngTotalMathProblems = 9

lngNumberCount = 0
lngIteration = 1
Do While lngNumberCount < lngTotalMathProblems
For lngRow = 0 To (-(Int(-(lngTotalMathProblems - lngNumberCount) / _
(lngColumns - lngIteration + 1))) - 1)
lngNewNumber = lngIteration + lngRow * lngColumns
MsgBox lngNewNumber
lngNumberCount = lngNumberCount + 1
Next lngRow
lngIteration = lngIteration + 1
Loop
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top