简体   繁体   中英

Adding a form control within module VBA

I've tried doing multiple searches, but may be wording incorrectly giving me info that doesn't apply.

I have a macro that parses through data, creates a new workbook and within that, a new worksheet. I want to be able to throw a form control or some sort of option for the user to add more data after the fact. Follow a similar example below to get a better understanding.

Say I have a workbook that I call "analyzer" and takes some input, formats it and also adds a summary tab. For instance, I'm a business and have all transactions made in my small store for a given month in a spreadsheet, .txt file etc. This is the input that "analyzer" takes in and formats.

"Analyzer" has a form control button on it and when you click it, it pops open a dialog box for you to select whatever months you want to analyze. Let's say its March. When I click on that button, I select January and February, it creates a new workbook, we'll call "Month_eval", formats each month in it's own worksheet and then adds a summary worksheet at the end for a "quick glance" view. Now I have this workbook, "Monthly_eval" that has three worksheets, Jan, Feb and Summary, but no real easy way to add say March or any additional months and append them to it or the summary worksheet.

What I would like to is add a form control button to the "summary" tab/worksheet to basically analyze more months of data and append to "Month_eval". The problem is this doesn't exist until I run the "Analyzer" workbook. I can't figure out how to phrase/search this to get relevant results. I think I should be able to get it from there by assigning a procedure to the button click.

I apologize if this is asked multiple times. If there is something relevant or almost identical, please post and I'll close the thread.

So from data in WBX you want to create a new workbook WBY with N worksheets containing monthly analysis, and this WBY will have the functionality to append additional data from WBX?

I think maybe you will need to create a class for this WBY.

Why not have a Summary workbook (SWB) and an analysis workbook (AWB). When you want to analyse the data you just export it from SWB to AWB and do your formulas and view it, instead of generating a new workbook everytime?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM