Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a database, where in the first column some cells are merged (by
2, 3 or more) and some are not. I want to number them in order that every single or "group-of-merged-cells" cell will have just one number. Excel says that autonumbering could be applied only to cells with the same size. For example, first cell is single, 2nd + 3rd are merged, 4th is single and 5th+6th+7th are merged. This way about 10000 rows in first column. How to number them in order? I have a VBA script to number them, but (in the example above) first has number one, second has number two, BUT third (it is row number 4!) has number 4 = they are numbered from the first cell of the merged group. It is wrong, on the 4th row it has to be a "3". Huh, apologise my poor english, I hope the problem is set clear ;o) Thank you for answer, Imagino |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub numberCells()
Dim i As Long, j As Long i = 1 j = 1 Do If Cells(i, "B").MergeArea.Rows.Count 1 Then Cells(i, "B").Value = j i = i + Cells(i, "B").MergeArea.Rows.Count Else Cells(i, "B").Value = j i = i + 1 End If j = j + 1 Loop Until j 20 End Sub might be a possibility. As written it goes down column B. Change to reflect your column. Adjust i to reflect the row you want to start in. and change 20 to indicate when to stop numbering. -- Regards, Tom Ogilvy "Imagino" wrote in message om... I have a database, where in the first column some cells are merged (by 2, 3 or more) and some are not. I want to number them in order that every single or "group-of-merged-cells" cell will have just one number. Excel says that autonumbering could be applied only to cells with the same size. For example, first cell is single, 2nd + 3rd are merged, 4th is single and 5th+6th+7th are merged. This way about 10000 rows in first column. How to number them in order? I have a VBA script to number them, but (in the example above) first has number one, second has number two, BUT third (it is row number 4!) has number 4 = they are numbered from the first cell of the merged group. It is wrong, on the 4th row it has to be a "3". Huh, apologise my poor english, I hope the problem is set clear ;o) Thank you for answer, Imagino |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy paste non merged to merged cells | Excel Worksheet Functions | |||
Auto Numbering a merged Cells Excel 2003 | Excel Discussion (Misc queries) | |||
Autofit Merged cell Code is changing the format of my merged cells | Excel Discussion (Misc queries) | |||
how do i link merged cells to a merged cell in another worksheet. | Excel Worksheet Functions | |||
Sorting merged cellsHow do I sort merged cells not identically siz | Excel Worksheet Functions |