Printing into another workbook.

jrg_1411

New Member
Joined
Jan 23, 2011
Messages
2
Hi, I have a feeling this may be out there somewhere, but after extensive searching, I can't find it.

I want to use VBA to print cells into another workbook in the same way that you can print into another sheet in the same workbook using code similar to this:

(For example if I wanted to print the first 3 columns in that row each time there was information about Sydney)

If Sheet1.Cells(1, 1) = Sydney Then

Sheet2.Cells(1, 1) = Sheet1.Cells(1, 1)
Sheet1.Cells(1, 2) = Sheet1.Cells(1, 2)
Sheet1.Cells(1, 3) = Sheet1.Cells(1, 3)

End If

Note that I do not want to copy paste, or to link the cells, which are possible through excel.
I have thousands of cells and I want VBA to search through them and when it finds a match for my criteria, to take the value in Workbook("Book1.xlsx") that I am searching in, and then for that information to be printed to Book2.xlsx.

Any help would be much appreciated
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Sorry, the middle bit should read

Sheet2.Cells(1, 1) = Sheet1.Cells(1, 1)
Sheet2.Cells(1, 2) = Sheet1.Cells(1, 2)
Sheet2.Cells(1, 3) = Sheet1.Cells(1, 3)

not that this code is directly what I want to do, just an example
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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