extract to another workbook and save using desktop path

dudematters21

New Member
Joined
Oct 12, 2024
Messages
10
Office Version
  1. 365
hello good day masters!
my first post here, thank you for the help in advanced

i have recorded a macro to extract a sheet then paste it another workbook
my question is can we add a code werein i can save this using file name based on a cell value
lets say -- "K4" has a text saying ABCDE, so I want to save it using that name.. ofcourse this value constantly changes

so far this is the code that came up..
i hope there's a solution..

Sub Xtract ()

Sheets ("Sheet1").Select
Range("B1:C3").Select
Selection.Copy
Range ("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Sheet2").Select
Application.CutCopyMode = False
Sheets("Sheet2").Copy
Range("E1:F1").Select
Selection.Copy
Application.CutCopyMode = False
ActiveWorkBook.SavaAs Filename:="H:\FFFF.xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup=False
Windows("MAIN.xlsb.xlsm").Activate
Range("A6").Select
End Sub
 
Change this line
Code:
wb1.Sheets("Farm").Range("A1:B11").Copy Activeworkbook.sheets("Sheet1").Range("A1")
to this
Code:
Activeworkbook.Sheets("Sheet1").Range("A1:B11").Value = wb1.Sheets("Farm").Range("A1:B11").Value

Just for your information, the problems you have is because you have not given us the proper information.
Think things through before you ask fo a solution.
Two more things.
Don't quote unless absolutely necessary, which seldom is the case. Refer to post numbers instead if you have to.
Also, put your code between code tags. See attached.

Use Code Tags MrExcel.JPG
 
Upvote 0
Solution

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Change this line
Code:
wb1.Sheets("Farm").Range("A1:B11").Copy Activeworkbook.sheets("Sheet1").Range("A1")
to this
Code:
Activeworkbook.Sheets("Sheet1").Range("A1:B11").Value = wb1.Sheets("Farm").Range("A1:B11").Value

Just for your information, the problems you have is because you have not given us the proper information.
Think things through before you ask fo a solution.
Two more things.
Don't quote unless absolutely necessary, which seldom is the case. Refer to post numbers instead if you have to.
Also, put your code between code tags. See attached.

View attachment 118283
sorry jus really new here.. this is noted .

and thanks for the help jolivanes, youve been amazing! appreciate it
 
Upvote 0

Forum statistics

Threads
1,224,567
Messages
6,179,569
Members
452,926
Latest member
rows and columns

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