Problem with formula

kluitna

Board Regular
Joined
Mar 10, 2002
Messages
75
First off thanks to Al Chara, you code helped allot in getting me this far, but here is my problem

I can't get the follow code to work right:
strfile = Source
SheetName = Workbooks(Source).Worksheets(h).Name
ActiveCell.FormulaR1C1 = "='" & strfile & "'!R21C4"

it either puts the sheet numer in or just the file refering to the first work sheet. I can get one or the other but not both. gets frustrating to be so close to a goal.

Can anyone tell how to make this look at the file source and the sheet number coresspoding to h. any help is much apreciated.

Also at the end of the loop I want to close the sile souce, source is actually a varible. just a referece to a cell in the workbook. can't seem toget any of the functions to recognize it to close. I am a bit confused.

Again any help is much appreciated
Paul
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hi kluitna,

I believe the problem is that the formula reference your code builds does not include the worksheet. It should be:

ActiveCell.FormulaR1C1 = "=[" & strfile & "]" & SheetName & "!R21C4"
 
Upvote 0

Forum statistics

Threads
1,214,527
Messages
6,120,054
Members
448,940
Latest member
mdusw

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