999HelpPlease
New Member
- Joined
- Jul 16, 2014
- Messages
- 35
I need to create a VBA that asks how many workbooks we want to create and then save them numbering them 1.xlsx to however many we end up with.
I have started the macro but I only know how to write it using this and it only gives me 10. I need it to ask how many we are going to create.
Sub 2()
Dim i As Double
For i = 1 To 10
Workbooks.Add
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "" & i & ".xlsx"
ActiveWorkbook.Close
Next
End Sub
I also have it this way
Dim ProceedStatus As String
ProceedStatus = InputBox("Do you want to create a new workbook ? Yes / No")
Do While LCase(ProceedStatus) = "yes"
Workbooks.Add
ProceedStatus = InputBox("Do you want to create a new workbook ? Yes / No")
Loop
End Sub
They both do a part but neither really work.
Can someone help me out?
I have started the macro but I only know how to write it using this and it only gives me 10. I need it to ask how many we are going to create.
Sub 2()
Dim i As Double
For i = 1 To 10
Workbooks.Add
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "" & i & ".xlsx"
ActiveWorkbook.Close
Next
End Sub
I also have it this way
Dim ProceedStatus As String
ProceedStatus = InputBox("Do you want to create a new workbook ? Yes / No")
Do While LCase(ProceedStatus) = "yes"
Workbooks.Add
ProceedStatus = InputBox("Do you want to create a new workbook ? Yes / No")
Loop
End Sub
They both do a part but neither really work.
Can someone help me out?