Help with a macro

yaroslav89

New Member
Joined
Jul 11, 2018
Messages
10
Hello Everyone,

My macro is basic and all its doing is copying (specific range) and pasting that range in another file. Because there is a lot of data to copy and from many different files. It is difficult to keep track of what is copied and what is still missing. I would like to have some sort of a tracker. Maybe a loop? Basically I would like to create an additional step. If file is copied, then give me a result of a specific cell in that copied file (Let's just say A1) and keep giving me results for every file that is being copied. Ideally, I would like the result to be in the file where the rest of the data is being copied, maybe just a different tab, but immediate window is ok too. If you have any thought or ideas, I would greatly appreciate. Below is my code in its basic form.


Sub Extract_Data()

Dim x As Workbook, y As Workbook
Dim ws1 As Worksheet, ws2 As Worksheet

'x is copy data
'y is paste data
Set x = Workbooks.Open("C:\Users\Documents\Data")
Set y = Workbooks.Open("C:\Users\Documents\Final Product")

Set ws1 = x.Sheets("Sheet1")
Set ws2 = y.Sheets("Sheet1")

ws1.Cells.Range("A1:R6").Copy ws2.Range("A1")

y.Close True
x.Close False
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Any ideas how to create a some sort of a tracker and will give me a result of what file is being copied. TIA.
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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