View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default autofill without a destination range

Here ya go:

Sub InsertCol()

Dim lastrow As Long


lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
Range("A2:A" & lastrow).Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"

End Sub

Notice, this fills in gaps, based on data in ColumnA. If you want other
columns to be populated, add code just like the above example. If you want
to fill data in one column, based on the last row in another column, you can
do that too; the code is slightly different for that scenario.


Remember to make a back of your Excel file, just in case the result
is...ummmm...unintended. It's a total PITA to try to recover lost data.

Regards,
Ryan---

--
RyGuy


"Peruanos72" wrote:

Hello all,

i'm trying to autofill without specifying a destination range. is this
possible? i have data in a column seperated by blank cells. i'm looking to
autofill with one cell and then moving down to the next cell with data and
autofilling again. this process repeats until there is no more data to
autofill. note: the destination ranges change daily.

thanks in advance