Filling out blank spaces with previous value

edTech

New Member
Joined
Dec 8, 2019
Messages
33
Office Version
  1. 2019
Platform
  1. Windows
I have data in an excel sheet that has blank spaces in column B and C. I want to fill them with its previous values. I have the VbScript code below semi working as I think my issue is the FormulaR1C1, but I cannot get it to work. Any suggestions?

Sample Data:
A​
B​
C​
TimeStart RaceEnd Race
225586.586.5
263498.5
578988.9

Code:

With objReadWS

lastRow = .Range("B" & .Rows.Count).End(xlUp).Row
lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column

Set rng = .Range(.Cells(2, 2), .Cells(lastRow, lastCol))
rng.Select

rng.SpecialCells(xlCellTypeBlanks).Select

rng.FormulaR1C1 = "=R[-1]C[2]"

rng.Select
rng.Copy
rng.PasteSpecial -4163, -4142, True, False


End With
 
You're welcome & thanks for the feedback
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,224,823
Messages
6,181,170
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