iamdeeflow
New Member
- Joined
- May 10, 2018
- Messages
- 3
Hi everyone,
I've been trying to work on this project but it seems I'm going nowhere.
What I'm trying to do is to copy all sheets that has the same month. The sheets are named as "MAY 01", "MAY 02", "MAY 03" and so on. I have an InputBox to enter the month.
Here's my code. Appreciate who can help me on this.
I've been trying to work on this project but it seems I'm going nowhere.
What I'm trying to do is to copy all sheets that has the same month. The sheets are named as "MAY 01", "MAY 02", "MAY 03" and so on. I have an InputBox to enter the month.
Here's my code. Appreciate who can help me on this.
Code:
Sub MONTHLYFILE()
Dim mSheets As String
Dim ws As Worksheet
mSheets = InputBox( _
PROMpT:="Enter date in 'MMM' format", _
Title:="Create Monthly File", _
Default:="MMM")
Select Case StrPtr(mSheets)
Case 0
Exit Sub
Case Else
For Each ws In ActiveWorkbook.Sheets
If InStr(1, ws.Name, mSheets) <> 0 Then
ws.Select False
End If
Next ws
End Select
'dont know what code to copy the selected sheets
Set WB = ActiveWorkbook
WB.SaveAs "REV " & mSheets & " 2018.xlsx"
WB.Close
End Sub