|
-
Apr 9th, 2009, 11:16 AM
#1
Thread Starter
New Member
[RESOLVED] Restrict the input value of a message box
Hi everyone,
I am quite new to the VB programming world but in a few days I learnt quite a lot
I want to create a message box that would pop up after a click on a button in sheet1 and according to the input value x, the macro will copy x-1 times the sheet 2.
I wrote this code but no matter the number between 2 and 4, it will always copy only once the sheet2. For x=1, no copy is needed.
Sub NbOfSheet2ToCopy()
x = InputBox("How many copies of Sheet2 would you like? Please enter a number between 1 and 4")
If x >= 1 Or x <= 4 Then
numtimes = x - 1
Sheets("Sheet2").Copy _
After:=ActiveWorkbook.Sheets("Sheet2")
Sheets("Sheet2").Select
Else: MsgBox ("Please enter a number between 1 and 4")
End If
End Sub
Is it possible to have the copied sheets in order ?
Thank you for your help !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|