Solved

VBA Excel 2010 - Group sections on a worksheet

Posted on 2016-07-24
2
27 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
2 Comments
 
LVL 48

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This is an Add-On procedure to be used in conjunction with the code provided in Reducing EE Email Clutter using Outlook (http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/A_3146-Outlook-Processing-EE-emails-on-Receive.…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now