View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default VBA code to fill down

Something like:

Sub copy_down()
Dim r As Range, rr As Range, n As Long
With ActiveSheet.UsedRange
n = .Rows.Count + .Row - 1
End With

Set r1 = Range(Cells(1, "H"), Cells(n, "H")).SpecialCells(xlCellTypeBlanks)
Set r2 = Range(Cells(1, "I"), Cells(n, "I")).SpecialCells(xlCellTypeBlanks)
Set r = Union(r1, r2)
For Each rr In r
rr.FillDown
Next
End Sub


But for the fill-down to work, H1 and I1 must not be empty.
--
Gary''s Student - gsnu200787


"Secret Squirrel" wrote:

I have some VBA code that imports certain columns (a thru g) from another
spreadsheet. I also have two columns of formulas in the spreadsheet that I'm
importing into that I need to fill down after the import is done. Columns H &
I have these formulas. How would I add to my VBA code to have it fill down
these formulas once the import is complete and how do I have the fill down
code stop where the last row of imports is?