VBA Loop

  • Thread starter Thread starter ASteele
  • Start date Start date
A

ASteele

I need to run a copy code an "x" number of times. The value for "x" is
variable and I would like to declare it within the code for the copy routine.

What is the easiest way for a beginner, like me, to write the code?
 
First you need to understand your goal and determine if a loop is the
best way to accomplish it. If so, then you need to decide what type of
loop to use. There are several types of loops, but unless you disclose
how 'x' is calculated, it would be difficult to suggest the
appropriate type.

--JP
 
Example code............

Sub SheetCopy()
Dim x As Long
Application.ScreenUpdating = False
shts = InputBox("How many times")
For x = 1 To shts
ActiveSheet.Copy After:=ActiveSheet
Next x
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP
 
Back
Top