S
spurtniq
Here's my code, in a userform, based on this message:
'Filling down a column without dragging over every cell? '
(http://www.mrexcel.com/board2/viewtopic.php?t=68550&highlight=filling+column)
Relevant Section of msg:
Here's what I've got so far:
I'm down to the point where I've selected and copied the formula.
Now I want to highlight the cells down, based on the fomula for
the variable "i" and then filldown the formula.
I'm trying, and not having much luck by trying to accomplish this
using some variant of "offset".
Basically, what I want to do is:
User input:
Start_Cell
Beg_Val
End_Val
Incr
Where what happens from there is:
Goto the Start_Cell
Enter the Beg_Val
Drop down one Cell
Enter the formula = (One Cell Up) + Incr Value
Copy this Cell
Select, Highlight, or Activate Cells down based on an offset of:
i = (End_Val / Incr) - 1
So, for:
Start_Cell = E5
Beg_Val = 3
End_Val = 30
Incr = 3
i = (30/3) - 1
i = (10) - 1
i = 9
(Based on the way I've got this setup so far, the end value could
be either -1 or -2 (i.e. (30/3) - 1 or (30/3) -2) depending on what
works best for this)
Would then drop down, highlight, select to E14
and copy or filldown the formula from E6 through to E14
creating the series:
3 - 30 in cells E5:e14 incremented by 3
So far, I'm not having much luck with this very last piece of
the puzzle.
Anyone?
Thanx.
'Filling down a column without dragging over every cell? '
(http://www.mrexcel.com/board2/viewtopic.php?t=68550&highlight=filling+column)
Relevant Section of msg:
Re: Filling down a column without dragging over every cell?
Alternative procedure to copy a formula down for the range
D2212500:
1 Select the cell with the formula (D22)
2 In the Name box, change D22 to D2212500
3 Press Enter to select
4 Press Ctrl-D (that's the Ctrl key and D together)
Regards,
Mike
Here's what I've got so far:
Private Sub OK_Button_Click()
Application.ScreenUpdating = False
Dim i As Integer
Set UserRange = Range(DataFill.Start_Cell)
Range(DataFill.Start_Cell).Value = CInt(Beg_Val)
End_Val = CInt(End_Val)
Incr = CInt(Incr)
Range(DataFill.Start_Cell).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=R[-1]C+" & Incr
Selection.Copy
i = (End_Val / Incr) - 1
ActiveCell.Offset(i, 0).Activate
Selection.FillDown
Unload DataFill
Application.ScreenUpdating = True
End Sub
I'm down to the point where I've selected and copied the formula.
Now I want to highlight the cells down, based on the fomula for
the variable "i" and then filldown the formula.
I'm trying, and not having much luck by trying to accomplish this
using some variant of "offset".
Basically, what I want to do is:
User input:
Start_Cell
Beg_Val
End_Val
Incr
Where what happens from there is:
Goto the Start_Cell
Enter the Beg_Val
Drop down one Cell
Enter the formula = (One Cell Up) + Incr Value
Copy this Cell
Select, Highlight, or Activate Cells down based on an offset of:
i = (End_Val / Incr) - 1
So, for:
Start_Cell = E5
Beg_Val = 3
End_Val = 30
Incr = 3
i = (30/3) - 1
i = (10) - 1
i = 9
(Based on the way I've got this setup so far, the end value could
be either -1 or -2 (i.e. (30/3) - 1 or (30/3) -2) depending on what
works best for this)
Would then drop down, highlight, select to E14
and copy or filldown the formula from E6 through to E14
creating the series:
3 - 30 in cells E5:e14 incremented by 3
So far, I'm not having much luck with this very last piece of
the puzzle.
Anyone?
Thanx.