VBA fill blank cells with above value

ShaanB

New Member
Joined
Mar 27, 2015
Messages
35
Hi all, I'm reasonably new to VBA and learn by doing.... I'm looking for a macro that will fill blank cells to the next cell with data in it.
(I had images but the links kept appearing as broken for some reason, though they work fine in other forums)
Style NameColour
Size
Basic TeeBlackS
M
L
XL
RedM
L
Printed TeeBlue2
4
6
8
etc

<tbody>
</tbody>



I'm trying to fill the blank cells with the so I end up with Basic Tee Black S, Basic Tee Black, M, etc etc...

On the offchance they work for some and hoping it's just my network, here's the images:
xzmoGzT

nwKymfK



Any help would be greatly appreciated!
Shaan
 
Last edited:

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
As an example for column A, one way (although this is easy enough to do without a macro)...

Code:
Sub fillme()
With Range("A:A")
    .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
    .Value = .Value
End With
End Sub
 
Upvote 0
I would do both columns at once & only target the required rows.
Rich (BB code):
Sub Fill_Blanks()
  With Range("A2:B" & Range("C" & Rows.Count).End(xlUp).Row)
    .SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C"
    .Value = .Value
  End With
End Sub
 
Upvote 0
Thank you this is great. I managed to tweak it to cover my sheet (I have more columns than just style, colour and size).
I do realise it's simple enough to do without the macro, but I'm building this for some colleagues who are not Excel users and it's much simpler for me to say "click this button" than try to teach them keystrokes!

Thanks!
 
Upvote 0

Forum statistics

Threads
1,215,009
Messages
6,122,674
Members
449,091
Latest member
peppernaut

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