russjardine1
New member
- Joined
- Oct 8, 2014
- Messages
- 6
- Reaction score
- 0
- Points
- 0
I am trying to sort multiple sheets which are added to the workbook daily by date and time.
Each month I wish to remove the previous months sheets and place them in order within a workbook for the whole year.
I have put together a code which will sort "Aug" from " Sep", selecting all the Sep sheet tabs. I can not figure out how to move them to the other book. I will attach a sample sending and receive workbooks. The code I have so far is in the "thisworkbook"
of the vba.
Each month I wish to remove the previous months sheets and place them in order within a workbook for the whole year.
I have put together a code which will sort "Aug" from " Sep", selecting all the Sep sheet tabs. I can not figure out how to move them to the other book. I will attach a sample sending and receive workbooks. The code I have so far is in the "thisworkbook"
of the vba.
Code:
Sub Test()
Dim blnReplace As Boolean
Dim sht As Object
.
blnReplace = True
For Each ws In Sheets
If InStr(ws.Name, "Aug") = 0 Then
ws.Select blnReplace
blnReplace = False
' this next part of the code is ment to move the selected sheets but does not work
' module1 was an attempt to record a macro but it names the sheets in the array which
' will change all the time.
' MyObject.Move after:=Workbooks("receive.xlsm").Sheets("start")
End If
Next
' ActiveWorkbook.Save
' ActiveWindow.Close
' Range("C8").Select
End Sub