Macro that will save workbook at a specified location and name the file based on a cell....

candrews84

New Member
Joined
Aug 30, 2015
Messages
10
First off any input is greatly appreciated, here's what I am trying to accomplish via Macro/VBA code:

1. Copy cell A2 on tab 2 to cell $A$2 on tab 1

2. Copy cell B2 on tab 2 to cell $B$2 on tab 1

3. Copy cell C2 on tab 2 to cell $C$2 on tab 1

4. File Save As (make the save as name equal to the text in cell D2 on tab 1)

5. Save As location should save to C:/List/(folder named same as cell E2 on tab 1)

6. The macro starts over copying from A3 on tab 2 to tab 1 but all the paste locations remain the same on tab 1 they do not change.


Additionally for step 5 the folder will already exist at the save location I'm just wondering if the VBA code can reference cell E2 (say for example the text 'ABC' resides in this cell) in the workbook and know to match that to the folder in C:/List/ABC(folder)


I've tried to simplify this as best as possible but please let me know if this is clear. Any help is greatly appreciated as I am faced with a large mundane task and I am trying to automate it as much as possible.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
I have the following code but I am trying to edit it so that it not only references a cell for the file name but also starts the process over again as mentioned in the original post:

Sheets("tab2").Select
Range("A2").Select
Selection.Copy
Sheets("tab1").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("tab2").Select
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("tab1").Select
Range("B2").Select
ActiveSheet.Paste
Sheets("tab2").Select
Range("C2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("tab1").Select
Range("C2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("U8").Select
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:= _
"C:\List\ABC", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False

<colgroup><col></colgroup><tbody>
</tbody>

<colgroup><col></colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,353
Messages
6,124,464
Members
449,163
Latest member
kshealy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top