VBA to backfill data in each row

alexcon

New Member
Joined
Dec 29, 2017
Messages
20
vWpaFC.jpg


Looking for a piece of code that can dynamically backfill data as per image above.

It should always fill back to column B and handle additional rows if new rows are added.

Any suggestions appreciated.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
- Dynamically fill when? What's the trigger for the backfill?
- Backfill with what? Pictures of cats?
- Will the data to the right of the first cell filled have NO blanks?
 
Upvote 0
(Not sure if the image is loading for you, can be found here if you can't see it)

I'm going to assign it to a button macro.

Backfill with the red outlined cell.. So for item 1, it takes 0.56 as the value and fills that backwards. For Item 2 it uses 0.6042. For Item 3 it uses 0.256 (not 0.564). and so on.

The data to the right of column E can be ignored. There are NO blanks at all to the right of the first cell.

Can assume this is a formally defined "Table 1".
 
Last edited:
Upvote 0
Are your existing values, hard values, or the result of formula?
 
Upvote 0
In that case try
Code:
Sub BackFill()

   With Range("B:D").EntireColumn
      .SpecialCells(xlBlanks).Formula = "=rc[1]"
      .Value = .Value
   End With
End Sub
 
Upvote 0
In that case try
Code:
Sub BackFill()

   With Range("B:D").EntireColumn
      .SpecialCells(xlBlanks).Formula = "=rc[1]"
      .Value = .Value
   End With
End Sub

This causes it to go into an endless loop creating new blank table rows to the end of the sheet.

Is it also possible to make this with reference to "Table 1"?
 
Upvote 0
What are the header names in your table?
 
Upvote 0
Try
Code:
Sub BackFill()

   With Range("Table1[[#All],[COLOR=#ff0000][RSQ3][/COLOR]:[COLOR=#0000ff][P3][/COLOR]]")
      .SpecialCells(xlBlanks).FormulaR1C1 = "=rc[1]"
      .Value = .Value
   End With
End Sub
Where the value in red needs to be the col B header & the value in blue is col D header
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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