Copy only 1 sheet from 1 excel and save it another file.

1 excel file has multiple sheets. I want to copy 1 sheet into another excel file and save with a new name.
rishaanAsked:
Who is Participating?
 
gtglonerCommented:
Here is some code that might serve as an example. Make sure to type in exactly the sheet and workbook names asked for,  for this to function properly.
Sub movesheet()

 Dim sheetname As String
 Dim workbookname As String
 Dim newsheetname As String
 
 sheetname = InputBox("Type the name of the sheet that is to be copied and renamed")
 workbookname = InputBox("Type the name of the open workbook that the sheet is to be inserted into")
 newsheetname = InputBox("Type the new name of the sheet in the box below")

    Sheets(sheetname).Select
    Windows(workbookname).Activate
    Sheets(sheetname).Copy After:=Worksheets(Worksheets.Count)
    ActiveSheet.Name = newsheetname
    
End Sub

Open in new window

0
 
jppintoCommented:
And you want a macro to do this or just want to know how to do it manually?
0
 
gtglonerCommented:
Note to my above code: You must have both source and target workbooks open first before running this macro.
0
 
rishaanAuthor Commented:
Need to do in .Net c#

0
 
rishaanAuthor Commented:
 


Not working while copying and pasting--look in code attached
copypaste.txt
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.