LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help - Selecting and pasting into range

Based on this process:

Alternative procedure to copy a formula down for the range
D22:D125:

1 Select the cell with the formula (D22)
2 In the Name box, change D22 to D22:D125
3 Press Enter to select
4 Press Ctrl-D (that's the Ctrl key and D together)

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.

Is this the best way to go about this? and
Is this the most optimal code to write?

Anyone?

Thanx.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
selecting a range Garth Excel Discussion (Misc queries) 2 March 4th 09 08:40 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
Selecting a Range Karen[_10_] Excel Programming 4 October 14th 03 10:57 PM
Selecting A Range Patrick Molloy Excel Programming 0 July 22nd 03 07:54 AM


All times are GMT +1. The time now is 03:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"