Hi, I searched the forum but haven't been able to figure out what I'm looking for. I'm sure this is super simple for most of you but my excel skills are hit or miss. What I'm looking to do is make two copies of a worksheet (to make three total) then rename them based on the file name. Then run the same three macros in each one of the three worksheets. Pretty simple right? But I discovered that the copying part throws an error when I use it in other files because the actual file name of the original file is part of the code. how can I get this to work on any file name? below is the code, and attached is a similar file that I want to use this macro on. I can't attach the original file this macro was created on because I accidentally overwrote it
Thank you.
Code:
Sub ThreeWaySplit()
'
' ThreeWaySplit Macro
'
'
Sheets("DL_8_Auburn Oven 3 TUS_01282019").Select
Sheets("DL_8_Auburn Oven 3 TUS_01282019").Copy After:=Sheets(1)
Sheets("DL_8_Auburn Oven 3 TUS_01282019").Select
Sheets("DL_8_Auburn Oven 3 TUS_01282019").Name = "Auburn Oven 3 TUS_260"
Range("F33").Select
Sheets("DL_8_Auburn Oven 3 TUS_0128 (2").Select
Sheets("DL_8_Auburn Oven 3 TUS_0128 (2").Name = "Auburn Oven 3 TUS_350"
Sheets("Auburn Oven 3 TUS_260").Select
Sheets("Auburn Oven 3 TUS_260").Name = "Auburn Oven 3 TUS_260"
Sheets("Auburn Oven 3 TUS_260").Select
Sheets("Auburn Oven 3 TUS_260").Copy After:=Sheets(2)
Sheets("Auburn Oven 3 TUS_260 (2)").Select
Sheets("Auburn Oven 3 TUS_260 (2)").Name = "Auburn Oven 3 TUS_450"
Sheets("Auburn Oven 3 TUS_260").Select
Application.Run "PERSONAL.XLS!Survey40wire"
Application.Run "PERSONAL.XLS!Survey20WireShrinkRunFirst"
Application.Run "PERSONAL.XLS!Survey20WirePortaitRunSecond"
Sheets("Auburn Oven 3 TUS_350").Select
Application.Run "PERSONAL.XLS!Survey40wire"
Application.Run "PERSONAL.XLS!Survey20WireShrinkRunFirst"
Application.Run "PERSONAL.XLS!Survey20WirePortaitRunSecond"
Sheets("Auburn Oven 3 TUS_450").Select
Application.Run "PERSONAL.XLS!Survey40wire"
Application.Run "PERSONAL.XLS!Survey20WireShrinkRunFirst"
Application.Run "PERSONAL.XLS!Survey20WirePortaitRunSecond"
End Sub