Solved

VBA Excel 2010 - Group sections on a worksheet

Posted on 2016-07-24
2
43 Views
Last Modified: 2016-07-25
Dear Experts,

Could you please have a short look on the attached picture and file, basically I have a worksheet in Excel where the product sections as one group are separated with an empty line:
The exampleGroupingSections.xlsx

Could you advise which VBA could assign increasing numbers to these groups, like that is marked with green color in column A?

Thanks in advance,
0
Comment
Question by:csehz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 41727082
Hi,

pls try

Sub macro()
Idx = 1
For Each c In Range(Range("A2"), Range("A" & Range("B" & Rows.Count).End(xlUp).Row))
    If c.Offset(, 1) = "" Then
    
    Else
        c.Value = Idx
        If c.Offset(1, 1) = "" Then Idx = Idx + 1
    End If
Next
End Sub

Open in new window

Regards
0
 
LVL 1

Author Closing Comment

by:csehz
ID: 41727100
Thank you that is awesome
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question