u/AndyJCohen

▲ 2 r/excel

Hey everyone!

I'm a beginner vba user. I'm trying to name my files and using d21 from every tab in the workbook. I have figured out how to name it if i only have one sheet, but I would like to be able to automatically populate a name with d21 from each sheet. Any help would be appreciated.

 ActiveWorkbook.SaveAs Filename:="RA REQUEST " & ActiveSheet.Range("D22") & " VEN " & ActiveSheet.Range("D21") & " BL-" & Range("D2").Value & " " & Left(Range("D5").Value, 8) & ".xlsx", FileFormat:=xlOpenXMLWorkbook
reddit.com
u/AndyJCohen — 11 days ago
▲ 6 r/excel

(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

reddit.com
u/AndyJCohen — 16 days ago