Mutiple AutoFill

T

Tomr

I have a spreadsheet with large amounts of data and I need to autofil
thousands of rows. Is there a formula, function or vb code that can d
this for me? Please see the attached example.

I certainly appreciate any help I can get.

Thanks in advance,
To

Attachment filename: test.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=47308
 
G

Gord Dibben

Tom

Sub Fill_Blanks()
'by Dave Peterson 2004-01-06
'fill blank cells in column with value above
Dim wks As Worksheet
Dim rng As Range
Dim LastRow As Long
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

Gord Dibben Excel MVP
 
G

Gord Dibben

Tom

A manual method I forgot to mention.

Select your range of data. Edit>Go To>Special>Blanks. With the blanks
highlighted, enter an = sign in active cell. Select with mouse-click on the
cell above. Hit CRTL + ENTER to fill blanks with contents of cell above each.

Gord

Tom

Sub Fill_Blanks()
'by Dave Peterson 2004-01-06
'fill blank cells in column with value above
Dim wks As Worksheet
Dim rng As Range
Dim LastRow As Long
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

Gord Dibben Excel MVP

I have a spreadsheet with large amounts of data and I need to autofill
thousands of rows. Is there a formula, function or vb code that can do
this for me? Please see the attached example.

I certainly appreciate any help I can get.

Thanks in advance,
Tom

Attachment filename: test.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=473083
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top