Author Topic: Need Excel 2007 Guru help!  (Read 532 times)

HeroHog

  • Technical Site Pig
  • Administrator
  • Senior Member
  • *****
  • Posts: 8,046
  • It can ALWAYS get worse!
    • FaceButt Profile
Need Excel 2007 Guru help!
« on: December 30, 2018, 01:54:33 AM »
I need to use Excel 2007 to reference value from unopened/closed Excel file with a formula or VB
For example, I want to turn this:
Code: [Select]
=INDEX('M:\Bills\Red River Bank\[Checking-4074-2018.xlsm]12-18'!$H$1,1,1)Into something like this:
Code: [Select]
=INDEX("'M:\Bills\Red River Bank\[Checking-4074-20" & $C$1 & ".xlsm]12-18'!$H$1",1,1)so that I can dynamically change the values in my workbook based on values in another CLOSED Excel file by using the value in my active workbooks $C$1 cell.

Why I am doing this is that at the end of the year, I close M:\Bills\Red River Bank\Checking-4074-2018.xlsm, take my template M:\Bills\Red River Bank\Checking-4074-20xx.xlsm, and rename it M:\Bills\Red River Bank\Checking-4074-2019.xlsm, then it references the last years file to populate key fields that are then used dynamically in the new file.

Google has failed me as all I can find are deprecated methods using stuff that the links to are dead.

Any help guys?
 :old:
I might not last very long or be very effective but I'll be a real pain in the ass for a minute!
MOLON LABE!

Doggy Daddy

  • Poobah
  • friend
  • Senior Member
  • ***
  • Posts: 5,333
  • From the saner side of Las Vegas
Re: Need Excel 2007 Guru help!
« Reply #1 on: December 30, 2018, 01:02:30 PM »
On first glance it looks like you want to use the "indirect" function.
Would you exchange
a walk-on part in a war
for a lead role in a cage?
-P.F.

HeroHog

  • Technical Site Pig
  • Administrator
  • Senior Member
  • *****
  • Posts: 8,046
  • It can ALWAYS get worse!
    • FaceButt Profile
Re: Need Excel 2007 Guru help!
« Reply #2 on: December 30, 2018, 01:32:03 PM »
On first glance it looks like you want to use the "indirect" function.

INDIRECT won't work on a closed file, tried it and my research verified it. I DID find this and will be trying it today...

https://www.encodedna.com/excel/copy-data-from-closed-excel-workbook-without-opening.htm
I might not last very long or be very effective but I'll be a real pain in the ass for a minute!
MOLON LABE!

cordex

  • Administrator
  • Senior Member
  • *****
  • Posts: 8,643
Re: Need Excel 2007 Guru help!
« Reply #3 on: December 30, 2018, 06:03:20 PM »
With Office 2016 I pull data from closed workbooks using VLOOKUP all the time but I don’t know if it works for a dynamically populated filename.

Doggy Daddy

  • Poobah
  • friend
  • Senior Member
  • ***
  • Posts: 5,333
  • From the saner side of Las Vegas
Re: Need Excel 2007 Guru help!
« Reply #4 on: December 31, 2018, 05:58:29 PM »
INDIRECT won't work on a closed file, tried it and my research verified it. I DID find this and will be trying it today...

https://www.encodedna.com/excel/copy-data-from-closed-excel-workbook-without-opening.htm

I missed that one word. "Closed"

I should have caught that.  I have a work file for scheduling students that references the file from the week(s) before to keep a tally of their hours.  Won't work on a closed file because I use indirect on it.
Would you exchange
a walk-on part in a war
for a lead role in a cage?
-P.F.

HeroHog

  • Technical Site Pig
  • Administrator
  • Senior Member
  • *****
  • Posts: 8,046
  • It can ALWAYS get worse!
    • FaceButt Profile
Re: Need Excel 2007 Guru help!
« Reply #5 on: January 01, 2019, 12:47:03 AM »
Index() WILL work BUT it HAS to be hard coded.
I might not last very long or be very effective but I'll be a real pain in the ass for a minute!
MOLON LABE!

Scout26

  • I'm a leaf on the wind.
  • friend
  • Senior Member
  • ***
  • Posts: 25,997
  • I spent a week in that town one night....
Re: Need Excel 2007 Guru help!
« Reply #6 on: January 01, 2019, 02:31:30 AM »
Can't you just copy last years sheet over onto a blank sheet in the new year's workbook and then reference the cells you need from that sheet/page?
Some days even my lucky rocketship underpants won't help.


Bring me my Broadsword and a clear understanding.
Get up to the roundhouse on the cliff-top standing.
Take women and children and bed them down.
Bless with a hard heart those that stand with me.
Bless the women and children who firm our hands.
Put our backs to the north wind.
Hold fast by the river.
Sweet memories to drive us on,
for the motherland.

HeroHog

  • Technical Site Pig
  • Administrator
  • Senior Member
  • *****
  • Posts: 8,046
  • It can ALWAYS get worse!
    • FaceButt Profile
Re: Need Excel 2007 Guru help!
« Reply #7 on: January 01, 2019, 01:38:31 PM »
That defeats the purpose of limiting/eliminating having to hand code/copy and link to the older data. Plus, this way, if you have to go back and make a change to December data in January, it auto updates January.
I might not last very long or be very effective but I'll be a real pain in the ass for a minute!
MOLON LABE!

cordex

  • Administrator
  • Senior Member
  • *****
  • Posts: 8,643
Re: Need Excel 2007 Guru help!
« Reply #8 on: January 01, 2019, 03:13:37 PM »
Excel is not a great database.

HeroHog

  • Technical Site Pig
  • Administrator
  • Senior Member
  • *****
  • Posts: 8,046
  • It can ALWAYS get worse!
    • FaceButt Profile
Re: Need Excel 2007 Guru help!
« Reply #9 on: January 01, 2019, 03:26:53 PM »
True! I'm hoping I can port this over to Open Office...
I might not last very long or be very effective but I'll be a real pain in the ass for a minute!
MOLON LABE!