Complex numbering - Need help


New Member
Sep 16, 2006
Ok.. so I have been trying to figure this out for weeks and I can't do it.. If one of you could help me I would appreciate it soo much..

Here is the situation.. I am doing this narrative/requirements gathering and need some assistance do the numbering because inserting or deleting a row causes me so much unnecessary time.

The numbering is as follows:

There is a header row number which is bold and the cell is filled with blue.
Then under each header row is a detailed row which is normal text and w/no fill. The detailed row has a extra subnumber...I want to be able to put in the first header number and get the sheet to autopopulate the remaining..

Here is an example of a header and detail rows..

20.3.1 -header -detail - detail -detail
20.3.2 -header -detail -detail -detail

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

You're having to renumber the entire list whenever you insert a row because it leaves a blank in the number column. Although your sample indicated a patern of three subheads to each header, I assume that isn't really a pattern else you wouldn't be adding rows. Is there any logic to what the new numbering scheme should be that a formula or macro could follow? If there is no pattern discernable, there is no automated solution.

Sometimes even if you can't tell what the pattern is, someone else can if there is enough data.

Upvote 0
There is a pattern to the number..

What are we are doing is there is a header step # which would consist of 3 distinct numbers.. XX.XX.XX (Example: 2.1.1 then next in the sequence would 2.1.2) so that the last number is constantly being updated.

Below is header step # is basically a requirement # that is associated to the header step. So if there are 5 requirements to get step 2.1.1 down. we would document them by adding a 4 distinct number 2.1.1.XX ( so the requirements under 2.1.1 are,,,,

So I am hoping to get a macro that will update the 3 distinct # XX.XX.XX when it encounters a new header. How it could determine a new header would be that that field would have a blue fill and be bold.

Then when it encounter a non-bold and no fill field it will update using the XX.XX.XX.XX requirement number.. but of course it would have to correspond to it's step.

Let me so an example:

2.1.1 - Cook Pasta - Requirement - Have heat source - Requirement - Have water to heat - Requirement - Have container for water - Requirement - Have pasta - Requirement - Have salt
2.1.2 - Serve Pasta - Requirement - Have dish for serve - Requirement - Have fork
2.1.3 - Serve Drink - Requirement - glass or mug for serving - Requirement - ice if not cold - Requirement - edible liquid
2.1.4 - Serve Dessert

I am think you get the point.. i want a macro that will do this numbering for me once I put in the first #... Is it possible and how do I do it???
Upvote 0

Place your cursor below the header row in the column with the numbering. Insert the number of rows you require (more than one row) and then execute the following macro.

Sub Macro1()
    Dim MyNum
    ActiveCell.Offset(-1, 0).Copy
    Selection.PasteSpecial Paste:=xlValues
    MyNum = ActiveCell.Text
    MyNum = MyNum + ".1"
    ActiveCell.FormulaR1C1 = MyNum
    Selection.AutoFill Destination:=Range(ActiveCell.Address, _
    ActiveCell.End(xlDown).Offset(-1, 0)), Type:=xlFillDefault
End Sub

If you're inserting a row between sub headers, you can use native Excel funtionality to AutoFill the sub headers. Just grab the bottom right corner of the cell outline with a left click and drag down.
Upvote 0
hope you are on xl 2002 or later version
Sub test()
Dim r As Range, i As Long, ff As String
With Application.FindFormat
       .Font.Bold = True
       .Interior.Color = vbBlue
End With
Set r = Columns("a").Find(What:="*",SearchFormat:=True)
If Not r Is Nothing Then
       ff = r.Address : i = 1
            Do While IsEmpty(r.Offset(i)) And Not IsEmpty(r.Offset(i,1))
                 r.Offset(i).Value = r.Value & "." & i
            Set r = columns("a").Find("*",After:=r, SearchFormat:=True)
            i = 1
       Loop Until ff = r.Address
End If
End Sub
Upvote 0

Forum statistics

Latest member

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back