Using code to make cells equal to cells in other sheet

KentKHI

Active Member
Joined
Oct 1, 2004
Messages
492
How can I use code to apply a simple formula to a range of cells that will make them equal to cells on another sheet?

example
sheet2 A1 should equal sheet1 A1
sheet2 A2 should equal sheet1 A2


This continues for about 45 cells, so I would like to identify the sheet to copy from, and paste a formula in each cell, rather than rewrite a formula for each cell.

Thanks!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Not 100% sure what you mean.

Code:
Worksheets("Sheet2").Range("A1").Formula = "=Sheet1!A1"

Worksheets("Sheet2").Range("A1").Copy Worksheets("Sheet2").Range("A1:A45")
 
Upvote 0
=IF([Workbook2.xls]Sheet1!$A$1<>"",[Workbook2.xls]Sheet1!$A$1,"")

Put this in the new workbook in A1
Replace the Workbook with the name of the workbook you want to replicate and Sheet with the name of the sheet in that workbook
 
Upvote 0

Forum statistics

Threads
1,223,287
Messages
6,171,197
Members
452,390
Latest member
kemafa77

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