VBA to fill missing Cells...

Matty

Well-known Member
Joined
Feb 17, 2007
Messages
3,717
Hello All,

Given the following data set:

Excel Workbook
AB
1DataADataB
2SomethingA15
3SomethingA47
4SomethingA48
5SomethingA26
6SomethingA52
7SomethingA45
8SomethingB36
9SomethingB89
10SomethingB72
11SomethingB14
122
1319
Sheet1
Excel 2003


What's the best way of filling Cells A12 and A13 with the value in the next populated Cell up, i.e. "SomethingB"?

I'm aware of the F5 > Blanks > Ctrl + Enter etc. method, but I'm looking for code to do this as it'll form part of a larger macro.

Thanks in advance.

Matty
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Try

Code:
Sub FillBl()
Dim LR As Long
LR = Range("B" & Rows.Count).End(xlUp).Row
With Range("A1:A" & LR)
    .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
    .Value = .Value
End With
End Sub
 
Upvote 0
Cheers Peter.

I will eventually get my head around all of these techniques!

Regards,

Matty
 
Upvote 0

Forum statistics

Threads
1,214,383
Messages
6,119,196
Members
448,874
Latest member
Lancelots

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