Range copy to a new worksheet

john5599

Board Regular
Joined
Mar 11, 2010
Messages
222
I have an excel file contains 8 sheet. I would like to copy full details to a new excel new file if 2 values not equel.

Suppose Cast Quantity <> Delivery then I want to copy it to a new excel file. All 8 should check then result should come with Head Lines to New File (Sheet1) one after another. I want all result of 8 sheet in New Excel file sheet 1.

Can some one to help me find the solution.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
as full details (in which column these data are entered etc) it is not possible to give full solution;

if you want to loop through the sheets (you are not copying in the same workbook but in another workbook)

Code:
dim j as integer,k as integer
j=worksheets.count
for k=1 to j
worksheets(k).activate
...
(your code statements  )

next k

If you are familiar with WITH statements you can use
with worksheets(k)
this will avoid activating each sheet.

if you want to copy the data to the first empty row in another saved wokbook(e.g book2.xls) which is opened.
Code:
dim dest as range 
set dest=workbooks("book2.xls).worksheets("sheet1").cells(rows.count,"A").end(xlup).offset(1,0)
dest.pastespecial


I have not checked with any data so there may be some minor mistakes.
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,876
Members
449,056
Latest member
ruhulaminappu

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