• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Move the Sheets to New workbook Excluding SomeFiles

K Raghavender rao

New Member
Hi All,

Hope everyone is fine.

I have 200 excel sheets in one workbook with named as Mail 1,2,3.....198 and two sheets are name as "Run" and "Macro_Time_Analysis_Sheet". I am trying to move the sheets (200 sheets) to new workbook excluding "Run" and "Macro_Time_Analysis_Sheet". Can some one please help in providing macro code.

Thanks,
K.Raghavender rao
 
Hi Raghavender ,

Try this..

Code:
Sub MoveSelectedSheet()
Dim arrsheet() As String
For i = 1 To Sheets.Count
    If Sheets(i).Name <> "Run" And Sheets(i).Name <> "Macro_Time_Analysis_Sheet" Then
        ReDim Preserve arrsheet(0 To k)
        arrsheet(k) = Sheets(i).Name
        k = k + 1
    End If
Next i
If k <> 0 Then Sheets(arrsheet).Move
End Sub
 
Back
Top