I am trying to merge cells an add a thicker border based on values in a list. The values in the list start at 1 and go to a maximum of 10; however, the list can stop at any number before 10 and restart to 1. I have the current code inputted in my properties:
This code produces the following image:
http://i.stack.imgur.com/SiZkD.jpg
I was wondering what I could add/edit the code to not depend on that extra "1" to merge the cells in Column B. Also, I was wondering what code I could add to make the borders thicker above the "1" or below the last number (similar situation to the previous sentence - so when I am at the end of the list, I don't need to add an extra "1" to use the thicker border). I have attached an example of how I picture it looking.
http://i.stack.imgur.com/ZYWfe.jpg
I am in Excel 2013. I am fairly inexperienced with VBA code so any help is appreciated. If more information is needed, let me know. Thank you.
Code:
Sub merge()
Dim srw As Long, frw As Variant
With Worksheets("Sheet1")
With Intersect(.Columns(3), .UsedRange)
srw = 7
Do While srw < .Rows.Count
frw = Application.Match(1, .Columns(1).Offset(srw + 1, 0), 0)
If Not IsError(frw) Then
.Cells(srw + 1, 1).Resize(frw, 1).Offset(0, -1).merge
srw = srw + frw
Else
srw = .Cells(Rows.Count, 1).End(xlUp).Row
End If
Loop
End With
End With
End Sub
This code produces the following image:
http://i.stack.imgur.com/SiZkD.jpg
I was wondering what I could add/edit the code to not depend on that extra "1" to merge the cells in Column B. Also, I was wondering what code I could add to make the borders thicker above the "1" or below the last number (similar situation to the previous sentence - so when I am at the end of the list, I don't need to add an extra "1" to use the thicker border). I have attached an example of how I picture it looking.
http://i.stack.imgur.com/ZYWfe.jpg
I am in Excel 2013. I am fairly inexperienced with VBA code so any help is appreciated. If more information is needed, let me know. Thank you.