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!
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,277
Not 100% sure what you mean.

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

Worksheets("Sheet2").Range("A1").Copy Worksheets("Sheet2").Range("A1:A45")
 

ufo_pilot

New Member
Joined
Nov 8, 2005
Messages
4
=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
 

Forum statistics

Threads
1,077,783
Messages
5,336,303
Members
399,074
Latest member
rlong98

Some videos you may like

This Week's Hot Topics

Top