Thread: Looping Code
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default Looping Code

no loop required.
See my answer from this morning. It only required a small change. Its better
for everybody to follow the same thread - it just measn people don't waste
their time sending the same work as already done. If its not what you need,
just reply and say why. thanks

Option Explicit
Sub Main()
Dim qrows As Long
qrows = Range("M2") ' InputBox("How many rows")
If qrows 0 Then
Range("C15:k15").Copy
Range("C16").Resize(qrows - 1).PasteSpecial xlPasteAll
Application.CutCopyMode = False
End If


End Sub


"tpeter" wrote:

I have that attached code that I want to run based and the number of cell m2.
So if cell m2 = 5 I would like the copy and insert to happen 4 times. This is
for a custom form made by the end user. Any help would be great, I have never
tried to loop the same code over again.

Range("C15:K15").Select
Selection.Copy
Range("C15").Select
Selection.Insert Shift:=xlDown (need this to happen # of times
inidicated in cell m2)

Tim Peter