View Single Post
 
Old 10-24-2022, 05:58 AM
kilroyscarnival kilroyscarnival is offline Windows 10 Office 2021
Expert
 
Join Date: May 2019
Posts: 345
kilroyscarnival is just really nicekilroyscarnival is just really nicekilroyscarnival is just really nicekilroyscarnival is just really nice
Default

Will you be typing in the first value in each instance (for example in cells A2 and B2, A6 and B6)?

I'm not quite sure of your full intentions, but I would think that something simple like
=if(C3="","",A2) placed in cell A3 would copy the A value above if the sector value is not empty. You'd do the same for B, and it would copy the value directly above, all the way down. Then you could manually fill in where the values change.

You could also simply merge the values with as many blank cells exist underneath. A bit of VBA code to go that would look like:

Sub Merge_Cells()
Dim blnks As Range, r As Range
Dim c As Long

For c = 1 To 2
On Error Resume Next
Set blnks = Columns(c).SpecialCells(xlBlanks)
On Error GoTo 0
If Not blnks Is Nothing Then
For Each r In blnks.Areas
With Union(r.Cells(0), r)
.Merge
.VerticalAlignment = xlCenter
End With
Next r
End If
Next c
End Sub

Of course you may not want it vertically centered. Also, this doesn't work with some imported data where the blank appearing cell isn't quite blank, so if you have issues with it, examine the cell contents and make sure they are empty.
Reply With Quote