VBA copy sheet

jakobt

Active Member
Joined
May 31, 2010
Messages
337
In a workbook, which workbookname and sheet will change, but I want to copy into this workbook/sheet I am in when running the macro.

The code for what I want to copy is already written:

Developed a code:

workbooks.open Filename:="S:\Report.xlsx.

Sheets("Januay").select

Range("A1:z100").copy

How can this code be amended to include the objective mentioned above.
 
Thanks again for this code.
I was wondering if it would be possible to avoid having to opening and closing the WB2.
 
Upvote 0

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I was wondering if it would be possible to avoid having to opening and closing the WB2.
Not that I know of. I know you can lookup specific values from closed workbooks, but I do not think you can do a copy/paste from a closed workbook.
Why is that an issue? Our code opens it, copies what it needs, then closes it right away.
 
Upvote 0
It is a huge workbook. It takes time to open and close it. Think this would reduce the time.

I have another macro to get data from an access database. This macro does not need to open the database!
 
Upvote 0
This macro does not need to open the database!
As you are aware, Excel and Access are completely different beasts!;)

It sounds to me like you have a big database going on here. Any thought of just trying to do the whole thing in Access, and taking Excel out of the equation totally?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

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