Referencing a dynamic total from another worksheet

Edski

New Member
Joined
Mar 20, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi,

Apologies if this has already been covered in a previous thread, but I haven't been able to locate anything on this or other websites (probably poor search criteria on my part).

I am trying to populate a total from another worksheet, but although the value of the referenced worksheet is returned it is doesn't appear as a formula in the cell.

E.g., if cell 'K1' in worksheet 'MMM' shows a total of 5,000, in cell 'C2' in the worksheet 'Open Balances' I would expect to see the result 5,000 in 'C2' with the formula bar for 'C2' showing as '=MMM!K1'.
However, using the the following code it returns the result, but the formula bar doesn't show the formula and therefore cell 'C2' would not update as the total in worksheet 'MMM" changes.

This is what I was expecting:
Screenshot1.png


Relevant part of the code:
Dim str As String

Sheets("Open Balances").Select

Cells.Find(What:=str, after:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

ActiveCell.Offset(0, 2).Value = Worksheets(str).Range("K1")

This is what occurs when the macro is run:
Screenshot2.png


I need cell 'C2' to update as the total changes in the 'MMM' worksheet.

Any help would be greatly appreciated.

Thanks & regards.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi & welcome to MrExcel.
How about
VBA Code:
   ActiveCell.Offset(,2).Formula = "='" & Str & "'!K1"
 
Upvote 0
Hi & welcome to MrExcel.
How about
VBA Code:
   ActiveCell.Offset(,2).Formula = "='" & Str & "'!K1"
Thanks Fluff, that's awesome. It works perfectly.

Much appreciated.

Cheers,
Edski
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,631
Messages
6,120,645
Members
448,974
Latest member
DumbFinanceBro

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