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
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,497
Members
448,967
Latest member
visheshkotha

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