Copy Previous row data into blank cells (in a selected column) : EXCEL
Sub Fill_Blanks()
Dim col As Long
Set wks = ActiveSheet
With wks
col = ActiveCell.Column
‘or
‘col = .range(”b1″).column
Set rng = .UsedRange ‘try to reset the lastcell
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
Set rng = Nothing
On Error Resume Next
Set rng = .Range(.Cells(2, col), .Cells(LastRow, col)) _
.Cells.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If rng Is Nothing Then
MsgBox “No blanks found”
Exit Sub
Else
rng.FormulaR1C1 = “=R[-1]C”
End If
‘replace formulas with values
With .Cells(1, col).EntireColumn
.Value = .Value
End With
End With
End Sub
Copy previous row details into blank cells below Using VB Editor in ExcelThis entry was posted on Tuesday, January 15th, 2008 at 1:54 pm and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.