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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,214,925
Messages
6,122,301
Members
449,078
Latest member
nonnakkong

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