VBA for copying selected cells from all opened work books

lnlarxg

New Member
Joined
Jun 7, 2011
Messages
1
Hi all, what a fab wedsite! first time posting hope you can help:)

I am trying to write a VBA for copying a few cells from various opened workbooks (number of workbook varies depending on the number of reports I get on the day), and pasting them onto my active workbook

These cells are always in the same position on all workbooks.

I hope someone can help me on making this VBA for regconising all opened workbooks and copying the cells for these xls then paste onto my active workbook.

Much Much appreciated

Lnlarxg
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Welcome to the forum,

You could work with something like this.

Sub copyData()
Dim ws As Workbook
For Each ws In Workbooks
ActiveWorkbook.Sheets(1).Range("A2:B5").Copy
ActiveWorkbook.Close
Windows("Book1").Activate
Range("A6000").Select
Range("A" & Rows.Count).End(xlUp).Select
ActiveCell.Offset(1, 0).PasteSpecial xlPasteAll
ActiveWindow.ActivateNext
Next ws
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,604
Messages
6,179,857
Members
452,948
Latest member
UsmanAli786

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