How to refernece a range in a different worksheet

Ody

Board Regular
Joined
Oct 14, 2010
Messages
215
I am stumped. How do you reference a cell or range in another worksheet?

For example, from sheet 15 I want to reference the cell J1 in sheet 1.

Is this possible? What does the code look like? Thanks!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
With a formula?

=Sheet1!J1

The easiest way to get the syntax is to build the formula by pointing with your mouse.
 
Upvote 0
Try

='sheet 1'!J1


Or, from sheet 15, press =
Then click on the tab for sheet 1 and click cell J1 and press Enter.
 
Upvote 0
Sorry, I meant what was the VBA for referencing a cell or range in another sheet so that it's a dynamic reference and not static?

Sheet15.Range("J1").Copy Destination:=ActiveCell

That copies it for me but I need it to update if that cells information changes.
 
Upvote 0
You will have to enter the formula in the target cell in your VBA code. Record a macro while doing it manually to get the syntax.
 
Upvote 0
Ok thanks!

One alternate to my question.

What is the syntax if I wish to always reference the last sheet in my workbook so that when I add worksheets I can create one macro instead of having to constantly reference the new sheets?

Thank you!
 
Upvote 0
This puts a formula that references A1 on the last sheet in A1 on Sheet1:

Code:
Sub Test()
    Dim LastSheet As String
    LastSheet = Worksheets(Worksheets.Count).Name
    Worksheets("Sheet1").Range("A1").Formula = "='" & LastSheet & "'!A1"
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,248
Members
452,900
Latest member
LisaGo

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