referring to a cell in anothjer sheet

alberta

New Member
Joined
May 17, 2004
Messages
14
I'm stiill a newbie, and I have been struggling with the syntax to make this work and hope that someone can help my through it.

The final set of spreadsheets generated by some VBA code will need to have a bit of text changed each time that it is run. The user can open the “text_copy” sheet in the workbook and make whatever changes to cell A1 and A2, and I was hoping that the VBA code would display it in B14 AND B15 of the new sheets.

This isn’t working out too well for me.

Code:
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws
.Range("B14") = text_copy!$A$1
.Range("B15") = text_copy!$A$2
End With
Next

Any suggestions would be appreciated.

Albert
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686
Try:

Code:
 Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws
    .Range("B14") = sheets("text_copy").Range("A1").value
    .Range("B15") = sheets("text_copy").Range("A2").value
End With
Next
 

Watch MrExcel Video

Forum statistics

Threads
1,118,760
Messages
5,574,087
Members
412,566
Latest member
TexasTony
Top