Desparately need help changing the way this code locates its recipient file. Need it to ignore the file name but look for an 'open/active' file that holds a tab named "Collab" and paste into that file.
There will always be 2 files open when the analyst runs this code.
One is the source file "export.xls" and the recipient file will always have a tab called "Collab" however its file name will always vary so I need the code to ignore / remove the referencing of that file name.
You might ask, why copy the tab (and) copy a range of data?
At this point in our laborious process, the data needs to be copy/pasted,
however the full tab holding other important data will be utilized later in the process.
There will always be 2 files open when the analyst runs this code.
One is the source file "export.xls" and the recipient file will always have a tab called "Collab" however its file name will always vary so I need the code to ignore / remove the referencing of that file name.
Code:
Sub CopyPasteTabIntoDiffFile()
'
'-------------------------------------------------------------------------------------
' SPECIFIC STEPS:
' 1- SHOULD SELECT THE ACTIVE SOURCE FILE: "export.xls",
' 2- SELECTS THE SOURCE TAB: "Repair Data"
' 2- COPIES TAB INTO RECIPIENT FILE (which will have various .xls names)
' ...but will always hold a tab called: "Collab", therefore,
' ...if it finds an open active file w/ a tab named: "Collab"
' 3..IF TRUE, PASTE THE "Repair Data" TAB INTO THE RECIPEINT FILE.
' >> the below code is not good because it uses a specific file name and should not
'.... refer to a file but instead, locate an open file that has a tab called "Collab"
'-------------------------------------------------------------------------------------
'
Sheets("Repair Data").Select
Sheets("Repair Data").Copy After:=Workbooks( _
"35728P_testing_01232014.xls").Sheets(8)
'----------------------------------------------------------------
' SELECTS THE ACTIVE SOURCE TAB TO COPY/PASTE INTO RECIPIENT FILE
'----------------------------------------------------------------
'
Sheets("Repair Data").Select
'----------------------------------------------------------------
' SELECTS RANGE TO COPY TAB TO COPY/PASTE INTO RECIPIENT FILE
'----------------------------------------------------------------
'
Range("C9:K17").Select
Selection.Copy
'----------------------------------------------------------------
' SELECTS RECIPIENT TAB TO PASTE RANGE IN TO
'----------------------------------------------------------------
Sheets("RepairRules").Select
Range("A3").Select
ActiveSheet.Paste
Range("A3").Select
End Sub
You might ask, why copy the tab (and) copy a range of data?
At this point in our laborious process, the data needs to be copy/pasted,
however the full tab holding other important data will be utilized later in the process.