View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] amonymous@microsoft.public.excel.programming.com is offline
external usenet poster
 
Posts: 1
Default Help - Selecting and pasting into range

My apologies to Tom.

The code solution for this problem is actually much simpler.

Much MORE Tom. Much less me.

Gonna get a handle on this code yet.

Here's the corrected code.

Credit given where it's due.

Private Sub OK_Button_Click()
'
'UserForm named "DataFill" accepting variables
'
' Start_Cell
' Beg_Val
' End_Val
' Incr
'
' Example:
'
'Start_Cell = "E5"
'Beg_Val = 21
'End_Val = 101
'Incr = 5

Application.ScreenUpdating = False

numrows = Application.RoundUp((End_Val - Beg_Val) / Incr, 0)
Range(Start_Cell).Value = Beg_Val
Range(Start_Cell).Offset(1, 0).Resize(numrows).Formula = _
"=" & Range(Start_Cell).Address(0, 0) & "+" & Incr

Unload DataFill

Application.ScreenUpdating = True

End Sub