Thread: AutoFill Loop
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default AutoFill Loop

Sub PB_Get_Nums()
Range("F2").Select
Do
With ActiveCell
.End(xlDown).Offset(0, 1).FillDown

.Offset(0, 9).Select

End With
Loop Until IsEmpty(ActiveCell.Value)
End Sub

--
Regards,
Tom Ogilvy


"Pete" wrote in message
...
Tom

Thanks for your help, but I am not following your code.

Here is what I got so far
Sub PB_Get_Nums()
ActiveCell.Offset(1, 5).Range("A1").Select
Range("F2").End(xlDown).Offset(0, 1).FillDown
Do
With ActiveCell
ActiveCell.Offset(0, 9).Range("A1").Select


`Need autofill code here to fill down to last cell.


End With
Loop Until IsEmpty(ActiveCell.Value)
End Sub

I could simply tell it to select the next cell in my sheet ("O2") but I

have
roughly 45 of these to do in 8 different workbooks and want to loop

through
it to save time. I know it's probably an easy fix, but I am not seeing it.
--
Pete


"Tom Ogilvy" wrote:

Using example locations:
set rng = Range(cells(2,"B"),cells(rows.count,"B").End(xlup) )

gives you a reference to the filled cells. then if you wanted to fill
column C

rng.offset(0,1).Formula = rng.offset(0,1).Resize(1,1).Formula

or for autofill possibly

rng.offset(0,1).Resize(1,1).Autofill Destination:=rng.offset(0,1)

--
Regards,
Tom Ogilvy



"Pete" wrote in message
...
HI all, I am still pretty new at this VBA stuff. I have a need to

select a
formula in a spreadsheet and fill it down to the last cell possible,

then
offset over the the right 9 cell and Autofill again, offsett 9 cells

and
repeat until it can't find a activecell with info in it.

The problem is the cells I am Autofilling are all different amounts of

fill
some are 600 rows and some are 6000.

Please help if possible.
--
Pete