vba to copy from active sheet from email to active sheet from my files

Taskmaster013

New Member
Joined
Oct 18, 2011
Messages
20
Hi, In Excel 2007 I have a workbook sheet which I populate each day from an automated Excel data emailed file. I want to be able to copy the daily emailed sheet (sheet1) and paste it into my open workbook sheet on a macro button in my workbook sheet using vba code.

To help you understand, the current process is
- I open my excel workbook sheet (ready)
- Then I open my emailed excel data sheet
- I copy the full emailed data sheet and paste it into my workbook sheet (using view / switch to toggle from one to another).

I want to automate this process but the problem is that I never know what the emailed data sheet will be named although I know the name is 6 digits.xlsx if that helps?? My workbook sheet is named 'Cognos Input' (this is the destination sheet)

I never have more than the 2 excel books open at one time so I want my workbook to sense the emailed file and copy it to the 'Cognos Input' sheet on the click of a macro or even better automatically if this is possible.

P.S. I have searched for an answer for weeks to this!

Thanks, Mike
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,206,920
Messages
6,075,575
Members
446,147
Latest member
homedecortips

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