Excel geniuses?

Silly Car
Posts: 854
Joined: Mon Mar 16, 2020 7:53 pm
Has thanked: 143 times
Been thanked: 497 times

Excel geniuses?

Post by Silly Car »

Is it possible to set up excel to automatically populate fields on a macro based worksheet, collect the output, then enter another row of data to the fields and repeat until the data runs out?

I am attempting to find the optimum results from two sets of data and the macro based worksheet runs multiple calcs to get the output I’m after so it would be a ball-ache recreating those calcs over multiple lines of data and the worksheet is password protected so I can’t C&P the formulae into a new document to speed up the process.

:)
Mussels
Posts: 4438
Joined: Mon Mar 16, 2020 9:02 pm
Has thanked: 836 times
Been thanked: 1238 times

Re: Excel geniuses?

Post by Mussels »

So one workbook controlling another?
This looks like a good starting point but it's not something I've ever had the need to do.
https://stackoverflow.com/questions/349 ... -workbooks
User avatar
Rockburner
Posts: 4375
Joined: Sun Mar 15, 2020 11:06 am
Location: Hiding in your blind spot
Has thanked: 7814 times
Been thanked: 2527 times

Re: Excel geniuses?

Post by Rockburner »

Where's Olly when you need him?
non quod, sed quomodo
Mr. Dazzle
Posts: 13937
Joined: Mon Mar 16, 2020 7:57 pm
Location: Milton Keynes
Has thanked: 2550 times
Been thanked: 6244 times

Re: Excel geniuses?

Post by Mr. Dazzle »

This is 100% possible, I had a workbook that did exactly this at my old job....

...which i didn't create. Was done by a graduate nerd using vba.

Sorry.
A_morti
Posts: 755
Joined: Mon May 25, 2020 8:35 am
Location: Malta
Has thanked: 310 times
Been thanked: 568 times

Re: Excel geniuses?

Post by A_morti »

What you're describing isn't a macro, but a power query.

Power query is a very powerful way to collect and collate data. If you're willing to get into the rabbit hole, you'll soon be importing the data to a data model rather than a sheet so it will handle over the excel limit of 1m rows, and do calculations in a flash.
A_morti
Posts: 755
Joined: Mon May 25, 2020 8:35 am
Location: Malta
Has thanked: 310 times
Been thanked: 568 times

Re: Excel geniuses?

Post by A_morti »

Also: unless the password is an honesty-bix thing and you'll be in trouble for removing it... You can remove it.

Save the file as compatible with excel 97, then Google search VBA password breakers. Mostly they will tie up your computer for ages and not work, unless you know to save the file in compatibility mode first.
Mussels
Posts: 4438
Joined: Mon Mar 16, 2020 9:02 pm
Has thanked: 836 times
Been thanked: 1238 times

Re: Excel geniuses?

Post by Mussels »

Power query won't feed parameters into Excel, trigger a macro, collect the results and move on to the next parameter.

Power query is great at some things but it's rubbish at iterative processes and probably needs coding with R or Python to do this, an adaptable VBA method would be much simpler.
Silly Car
Posts: 854
Joined: Mon Mar 16, 2020 7:53 pm
Has thanked: 143 times
Been thanked: 497 times

Re: Excel geniuses?

Post by Silly Car »

Thanks all, the opportunity has passed as I got a minion (small yellow chap with one eye, squeaky voice) to crunch the numbers multiple times to get as close as possible to the desired outcome. Then the clients decided they just wanted to split the investment 50:50 as I originally suggested although this was after we found an optimum solution *

* excel workbook calculated the tax payable, based on an individual’s circumstances, on surrender of a particular type of investment.
A_morti
Posts: 755
Joined: Mon May 25, 2020 8:35 am
Location: Malta
Has thanked: 310 times
Been thanked: 568 times

Re: Excel geniuses?

Post by A_morti »

Mussels wrote: Mon Jun 27, 2022 9:35 pm Power query won't feed parameters into Excel, trigger a macro, collect the results and move on to the next parameter.

Power query is great at some things but it's rubbish at iterative processes and probably needs coding with R or Python to do this, an adaptable VBA method would be much simpler.
I'd have to see the inputs and outputs, but probably it could swallow the whole process in a handful of conditional columns without going to the trouble of macros. Maybe.