1 min readfrom Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

Splitting a 50 Tab Workbook Into Individual Spreadsheet and Renaming Them Using VBA

(Apologies in advance for formatting)

Hi, all!

I’m trying to write code that would break down a 50 book into individual spreadsheets. I’m a super beginner, but I have been able to separate all the tabs and save them, but the issue I’m having is renaming them. I would like to rename them using a particular cell on each spreadsheet. For example “Daily Report Vendor __D21___” Is this even possible? When I have attempted this it will reference the vendor/D21 on the active sheet.

The code I posted below is what I started with. I had to make small changes, but it’s mostly the same.

```

Sub ExportToXLSX()

Dim ws As Worksheet

Dim path As String

'Change this path to your desired folder

path = "C:\Users\Username\Desktop\SplitFiles\"

For Each ws In ThisWorkbook.Worksheets

ws.Copy

ActiveWorkbook.SaveAs Filename:=“Daily Report Vendor” & ".xlsx", FileFormat:=xlOpenXMLWorkbook

Next ws

End Sub

```

Sorry if this is obvious. Any help is appreciated

submitted by /u/AndyJCohen
[link] [comments]

Want to read more?

Check out the full article on the original site

View original article