troubleshooting Question

Merge and Label cells if same value

Avatar of Pearlyn Tan
Pearlyn Tan asked on
VBA
2 Comments1 Solution102 ViewsLast Modified:
How do I merge cells of same value then label each row of the merged cell by a serial number?
Assuming I have this:This is what I haveand I am trying to achieve this:This is what I want to achieve
I found a way to merge the cells if they are of the same value
For i = 4 To Range("A" & Rows.Count).End(xlUp).Row
    If Cells(i, 1) <> "" Then
        If Cells(i, 1) = Cells(i - 1, 1) Then
            Range(Cells(i, 1), Cells(i - 1, 1)).Merge
        End If
    End If

Any suggestions on how I can proceed with the labelling? Maybe a "do while", but I'm not sure how to make sure it restarts from 1 if the adjacent cell is not merged.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros