Copy active workbook name and past to cell in target workbook

Diogenes

New Member
Joined
Apr 2, 2014
Messages
34
Hi all,
I have a macro that asks the user to select a file then with an input box they choose a range to copy.
They will generally select (separately) up to 5 files across different locations to import data from.
As a check process and to reduce errors I would like the ability for the user to keep track of which files they have already imported.
My pretty lame attempt at this is below:
Code:
customerWorkbook.Activate
activeworkbook.Name   
targetSheet.Activate
emptyColumn = targetSheet.Cells(1, targetSheet.Columns.Count).End(xlToLeft).Column + 1
    With targetSheet
        .Cells(emptyColumn, 1).Select
        .Paste
    End With
How would you copy the file name of the active workbook into a cell of the targetsheet?
I understand that I am missing a step or two for copying the filename (I use "filename" as a string earlier on) but everything I have played around with so far just ends up running the error handler of the wider code with no successful importing of the filename - hence the "blank" canvas.
Any help would be greatly appreciated!
 

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