View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
TimT TimT is offline
external usenet poster
 
Posts: 69
Default Trying to repeat a procedure

Hey all!
Could someone please help me here with this code.
I would like for a range to be copied down x times, whereas x is filled in
from a userform.

This is what I did.

Private Sub Go_Click()

usrfrm_1.txtbx_Years.SetFocus

Dim ws As Worksheet
Set ws = Worksheets("Sheet1")

ws.Cells(3, 2).Value = usrfrm_1.txtbx_Years.Value

Dim ayear As String
With Worksheets("Sheet1")

ayear = .Range("YearsInPut").Value


Range("A7:C7").Select
Selection.AutoFill Destination:=Range("A6:C" & "ayear"),
Type:=xlFillDefault
Range("A6").Select

End Sub

I think I'm screwing it up at the 3rd to last line for the range.