![]() |
Input Box Trouble
I am trying to make it so that when a user inputs the amount of trips they
have taken, Excel automatically copys that amount of worksheets. I made a Macro that copys the worksheets but im not sure how to integrate that into an input box. the copy sheet code: Sheets("Individual Trip").Select Sheets("Individual Trip").Copy After:=Sheets(3) Thanks! |
Input Box Trouble
On 28 Apr., 16:40, Ewing25 wrote:
I am trying to make it so that when a user inputs the amount of trips they have taken, Excel automatically copys that amount of worksheets. I made a Macro that copys the worksheets but im not sure how to integrate that into an input box. the copy sheet code: * Sheets("Individual Trip").Select * * Sheets("Individual Trip").Copy After:=Sheets(3) Thanks! Hi Try this Sub TripsCopy() Dim Trips As Integer Dim tr As Integer Trips = InputBox("Enter no. of trips") If Trips 0 Then 'Sheets("Individual Trip").Select For tr = 1 To Trips Sheets("Individual Trip").Copy After:=Sheets(Sheets.Count) Next End If End Sub Regards, Per |
Input Box Trouble
That worked great thanks!!
"Per Jessen" wrote: On 28 Apr., 16:40, Ewing25 wrote: I am trying to make it so that when a user inputs the amount of trips they have taken, Excel automatically copys that amount of worksheets. I made a Macro that copys the worksheets but im not sure how to integrate that into an input box. the copy sheet code: Sheets("Individual Trip").Select Sheets("Individual Trip").Copy After:=Sheets(3) Thanks! Hi Try this Sub TripsCopy() Dim Trips As Integer Dim tr As Integer Trips = InputBox("Enter no. of trips") If Trips 0 Then 'Sheets("Individual Trip").Select For tr = 1 To Trips Sheets("Individual Trip").Copy After:=Sheets(Sheets.Count) Next End If End Sub Regards, Per |
All times are GMT +1. The time now is 04:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com