Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-29-2019, 03:20 PM
BCrenshaw BCrenshaw is offline Macro to create two copies of worksheet, then run macro. Windows 7 64bit Macro to create two copies of worksheet, then run macro. Office 2016
Novice
Macro to create two copies of worksheet, then run macro.
 
Join Date: Jun 2016
Posts: 3
BCrenshaw is on a distinguished road
Default Macro to create two copies of worksheet, then run macro.


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
Attached Files
File Type: xlsx DL_7_Renton Oven 1 TUS_01282019_101622.xlsx (54.4 KB, 9 views)

Last edited by BCrenshaw; 01-30-2019 at 10:31 AM.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to create two copies of worksheet, then run macro. Macro to print a value in the duplicate and triplicate copies only Marcia Excel Programming 2 09-26-2018 02:11 PM
Macro for printing 2 copies each on NCR paper for many different word docs Marq Word VBA 9 05-22-2017 08:31 PM
Looking for Help to Create a Macro (Sort) rsrasc Word VBA 5 04-16-2014 03:25 AM
Macro to conditionally create or go to worksheet Reinaldo123 Excel Programming 1 07-06-2012 07:23 AM
macro for comparing data from 3 columns and pasting into another worksheet ashukla Excel 1 06-24-2009 05:01 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:59 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft