Complex numbering - Need help

HelenMartin

New Member
Joined
Sep 16, 2006
Messages
2
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
20.3.1.1 -detail
20.3.1.2 - detail
20.3.1.3 -detail
20.3.2 -header
20.3.2.1 -detail
20.3.2.2 -detail
20.3.2.3 -detail
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
HelenMartin,

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.

Dufus
 
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 2.1.1.1, 2.1.1.2, 2.1.1.3, 2.1.1.4, 2.1.1.5)

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
2.1.1.1 - Requirement - Have heat source
2.1.1.2 - Requirement - Have water to heat
2.1.1.3 - Requirement - Have container for water
2.1.1.4 - Requirement - Have pasta
2.1.1.5 - Requirement - Have salt
2.1.2 - Serve Pasta
2.1.2.1 - Requirement - Have dish for serve
2.1.2.2 - Requirement - Have fork
2.1.3 - Serve Drink
2.1.3.1 - Requirement - glass or mug for serving
2.1.3.2 - Requirement - ice if not cold
2.1.3.3 - Requirement - edible liquid
2.1.4 - Serve Dessert
etc
etc
etc..

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
HelenMartin,

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.

Code:
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
Hi
hope you are on xl 2002 or later version
Code:
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
            Do While IsEmpty(r.Offset(i)) And Not IsEmpty(r.Offset(i,1))
                 r.Offset(i).Value = r.Value & "." & i
            Loop
            Set r = columns("a").Find("*",After:=r, SearchFormat:=True)
            i = 1
       Loop Until ff = r.Address
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,561
Messages
6,114,317
Members
448,564
Latest member
ED38

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 MrExcel.com.
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 "mrexcel.com".
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
Back
Top