Copy the above cell & make "bold" - on repeat pattern for each unique value

Theemeadelis

New Member
Joined
Jul 10, 2023
Messages
20
Office Version
  1. 365
Platform
  1. Windows
I have a large set of data where there is a blank row after each unique cell value in column N - sample showing below:

1689933111328.png


I am after a formula or VBA which will fill each of those blank cells in column N with the same value as the cell above it, but marked in bold.

e.g.

1689933211967.png


Is someone able to help?
 
Last edited:

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try this code:
VBA Code:
Sub MyFillBlanksMacro()

    Dim lr As Long
   
'   Find last row in column N with data
    lr = Cells(Rows.Count, "N").End(xlUp).Row
   
'   Populate blank cells with value above and bold
    With Range("N1:N" & lr).SpecialCells(xlCellTypeBlanks)
        .FormulaR1C1 = "=R[-1]C"
        .Font.Bold = True
    End With
   
'   If you want to change the formulas to hard-coded value, uncomment the next line
    'Range("N1:N" & lr).Value = Range("N1:N" & lr).Value
   
End Sub
 
Upvote 1
Solution
Try this code:
VBA Code:
Sub MyFillBlanksMacro()

    Dim lr As Long
  
'   Find last row in column N with data
    lr = Cells(Rows.Count, "N").End(xlUp).Row
  
'   Populate blank cells with value above and bold
    With Range("N1:N" & lr).SpecialCells(xlCellTypeBlanks)
        .FormulaR1C1 = "=R[-1]C"
        .Font.Bold = True
    End With
  
'   If you want to change the formulas to hard-coded value, uncomment the next line
    'Range("N1:N" & lr).Value = Range("N1:N" & lr).Value
  
End Sub
Perfect - thank you :)
 
Upvote 0
You are welcome.
Glad I was able to help!
 
Upvote 1

Forum statistics

Threads
1,215,350
Messages
6,124,430
Members
449,158
Latest member
burk0007

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top