How to extract & paste the filename into another workbook?

soidog

New Member
Joined
May 26, 2016
Messages
45
Hello,
I'm having a problem with extracting and paste the filename into another workbook.

I have code for:
Copy Cell "R19" in "Sheet1", in every workbook in folder "Test3".
Paste that value into workbook: "vikt.xlsm", column "W" with:
Workbooks("vikt.xlsm").Worksheets("Sheet1").Range("W" & Rows.count).End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues.

But how to:
Adjacent to that value in column "W", insert in column "X", the workbook name the value came from?

Any help would be much appreciated. :)
Thanks.
 
Just remember that you want to try to avoid Select and copy as much as possible, especially if you are doing large code and it involves large amounts of data.
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,215,778
Messages
6,126,841
Members
449,343
Latest member
DEWS2031

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