User-selected file for reference worsheet?

stormwind6

New Member
Joined
Nov 29, 2012
Messages
8
I'm trying to have a user-selected reference worksheet that pulls the cell data from a raw statistics worksheet to our formatted reporting sheet. I can get the data to pull, but I have to select the reference file for every cell. Anyone know how to make Excel "remember" what worksheet to reference after the user selects it? Some of my code is below. The bolded section is what's giving me trouble. It will pull from "[y]" worksheet, but i need to manually select it for every cell.

Thanks!

Dim strFile As String

strFile = Application.GetOpenFilename
If strFile = "False" Then

Exit Sub

Else
y = strFile




Sdate = InputBox("Which month would you like to pull from (1-12)?")
If Sdate <> "False" Then
x = Sdate + 7

Range("C9").Select
ActiveCell.FormulaR1C1 = _
"='[y]CONDENSADO ATENCION PACIENTES'!R" & x & "C41"
Range("C10").Select
ActiveCell.FormulaR1C1 = _
"='[y]CONDENSADO ATENCION PACIENTES'!R" & x & "C37"
Range("C11").Select
ActiveCell.FormulaR1C1 = _
"='[y]CONDENSADO ATENCION PACIENTES'!R" & x & "C2+'[y]CONDENSADO ATENCION PACIENTES'!R" & x & "C4"
Range("C18").Select
ActiveCell.FormulaR1C1 = _
"='[y]CONDENSADO ATENCION PACIENTES'!R" & x & "C11+'[y]CONDENSADO ATENCION PACIENTES'!R" & x & "C20"
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hi All,

I'm still having this issue, and can't seem to resolve it. Does anyone have any suggestions?

Thanks in advance!
 
Upvote 0

Forum statistics

Threads
1,223,417
Messages
6,171,996
Members
452,438
Latest member
jimmyleung

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