Create New Sheet > Change sheet name before Saving

torourke17

New Member
Joined
Jan 12, 2018
Messages
12
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I use an 'Uploader' to take data from excel to interface and fill in fields in a program I use. My workbook contains several of these 'Uploaders' and the program requires the sheet to be named "Uploader". Obviously my workbook can't contain more than 1 sheet named "Uploader" so the vba below takes my existing "xyz Uploader" sheet and saves the cell values as a file, in a designated folder, and closes the new sheet that is created.

Before uploading this file to my program, I need to open the new sheet that was saved and change the sheet name from "xyz Uploader" to "Uploader"

I want to know if I can add something to the coding below to copy "xyz Uploader" out of my work book, changes the name of the sheet to "Uploader", save it in that designated folder, and close the new sheet after it has been created.

Thoughts?

Sub SaveSheet()
Sheets("xyz Uploader").Select
ActiveSheet.Copy
With ActiveSheet.UsedRange
.Copy
.PasteSpecial xlValues
.PasteSpecial xlFormats
End With
Application.CutCopyMode = False
Dim Path As String
Path = "(Folder Location)"
ActiveWorkbook.SaveAs Path & ActiveSheet.Range("U7"), FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
Sheets("xyz Uploader").Select
End Sub
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Maybe
Code:
Sub SaveSheet()
Sheets("xyz Uploader").Copy
ActiveSheet.Name = "Uploader"
With ActiveSheet.UsedRange
   .Copy
   .PasteSpecial xlValues
   .PasteSpecial xlFormats
End With
Application.CutCopyMode = False
Dim Path As String
Path = "(Folder Location)"
ActiveWorkbook.SaveAs Path & ActiveSheet.Range("U7"), FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
Sheets("xyz Uploader").Select
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top