Excel set cell value on workbook open - excel

This is a good theory discussion. I have a VBA heavy workbook that pulls information from a database for a specific item. Let's pretend that that item is a sales invoice. The way the workbook works now is that there is a cell in which you put a invoice number then click a refresh button and all the information for that invoice is pulled and munged in the workbook.
Is there a way that, from a command line sorta thing, set the cell with the invoice number to a value then execute the refresh when the workbook is opened? I know that I can fire the refresh macro when the workbook open via VBA, the real question is can I set a cell value to something from outside Excel. The goal is to provide a hyperlink I build that when a user clicks it, the cell value is set then the data refreshed. I am not sure where to look for this answer.
Thank you.

From reading the link I have included below, it would appeear that you cannot pass command line parameters to excel directly, however, you can use vb script which accepts parameters and then the vb script opens excel and inserts the parameter value
Link to post on MSD

Related

Copying data from a dropdown menu to a seperate sheet as a report using VBA

Complete beginner with VBA and I think I'm doing something majorly wrong.
So context;
Creating a user friendly sheet to do checks on items etc. To keep it as simple as possible for other people I've decided to use drop down menus to input the majority of the data and tick boxes to say when the check has been done.
From here I want to add a big old button that will transfer the data from the cells, dropdown menu and tick boxes to another sheet or workbook.
I would also need the sheet or workbook to place the date the checks were done and create a new line with the information. So that I can look at a single sheet and see the wear and tear on the equipment in one form. (layout of this can be sorted out after wards just how to get it to go to a blank line etc.)
And finally to save the document.
drop down information is linked from another sheet within the workbook.
Now I've tried some code to work it out myself and it either doesn't copy the data as the cell is blank (drop down menus) or it just shoots up an error on the VBA page.
Could anyone assist in helping me work this code out? Even if its just the command syntax's that I would need to use.
Thanks in advance
Peter

Missing DataValidation DataSource

I am working on an excel spreadsheet. I have a dropdown with values. I need to add a value in there.
There is no macro and there is no connection. The only thing I found was:
I selected the cell at hand
Data -> DataValidation
In the source i can see this string =Variables!$D$1:$D$23
I do not have a sheet called variables or anything close to the word variables in any of the sheets. Where can this be coming from?
There is also protection on the workbook but not the individual sheets. Could this be the issue?
Thank you
You can usually check the contents of a hidden sheet quite easy using the Immediate Window.
So open the VBA editor (Alt-F11), go to the Immediate window (Ctrl-G), and try:
?Variables.[D17]
If this works, you can repeat this to see the other 22 validation values (or write a small sub, using Debug.Print ubstead of ?).

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?

How to stop Bloomberg links updating in Excel

I am trying to use an Excel workbook that has links to Bloomberg data in. The data has been pulled from Bloomberg already. I then want to ensure that when I send this workbook to someone that they can use the sheet without a Bloomberg terminal connection. The user without the Bloomberg feed has set calculations to manual in Excel however when they try and save the workbook it automatically tries to update the fields and gives #NAME errors in the fields where Bloomberg values should be.
Is there a way to stop Excel from trying to refresh the Bloomberg links when the workbook is saved? I have tried VBA Workbook_AfterSave and Workbook_BeforeSave events but that did not seem to work.
A touch embarassed to admit but in Options > Formulas > Manual there is a check box for calculating the workbook before saving. I unchecked that and it worked.
According to the license, you're not supposed to remove values obtained using the API (Excel) from the computer where the Bloomberg Terminal is installed. That being said, if cells cease being Excel formulas they will no longer attempt to update to an up-to-date value. To do this, copy the cells that currently have a BDP/BDH formula and right click -> paste special -> values. This is also useful if you don't want the values refreshing every time you open the worksheet on the same computer.

How to crack an Excel workbook that looks up values?

Alright I know this isn't 100% related to programming (the Excel book in question doesn't use VBA at all) but I'm hoping someone can help me out with this or point me in the right direction.
My boss got a spreadsheet from a vendor that has a combobox/dropdown list with various part numbers; when you select one it populates the rest of the form with a lookup containing additional items. I've been tasked with "cracking" this and finding the list that they're using to populate so we can make use of it.
The thing is... there's no VBA code, no macros, no data connections, and only one Worksheet displayed in Excel while the lookup code references a Sheet1. I've tried to display hidden worksheets and it says there are none... so where on earth could this list be kept? My boss is getting impatient and is asking me if I've broken it yet. It's not a big deal if it can't be done, I just have no clue where to continue looking for it and I don't know what to tell my boss when he asks me if I'm done.
Can anyone help?
It's possible to hide a worksheet using VBA so that it can't be unhidden from the UI.
Try the method for un-hiding all hidden workhseets outlined here:
http://www.automateexcel.com/2004/12/14/excel_vba_unhide_all_worksheets/
My guess is that it is a Data Validation list which references a constant list of values or a range on a "Very Hidden" sheet. In Excel 2007, select one of the cells with the drop-down, click on the "Data" tab in the Ribbon, click on "Data Validation" in the Ribbon and see what you have. In Excel 2003 it is the Data -> Validation... command.
Another possibility if you know the name of the worksheet is "Sheet1" is to add a new worksheet, enter "=Sheet1!A1" into cell A1 of the new worksheet, and copy this cell down and to the right for as large of an area as you need to see the data you are interested in.
If you can post a URL to download the workbook (assuming it is not a trade secret) you would be more likely to get an accurate answer.
Could it be some data stored on the same sheet.
Possibly in columns which are either hidden, or which are far off the actual page?
Isn't this just data from the worksheet only?
Column header dropdown lists acts as filters, they show distinct values of a column.
This is a feature of Excel.
The items could be cached from a currently unavailable resource. Try saving it out to xml and searching for a known string.
Click on the cell that display a drop down list when selected
From the menubar select data>validation
In the dialog box copy the content of the source text box
Now paste the content on any empty cell on your worksheet
Select a drag it down to see the values populating the list
Chris
------
Convert your Excel spreadsheet into an online calculator.
http://www.spreadsheetconverter.com
I am assuming that you have broken this by now, but just in case you havent. This is certainly a case of data validation using a named range which is house on another sheet that was designated "very Hidden" from the vba console. You will need to open up the VBA project of this worksheet and designated the "very Hidden" sheet to just Hidden and then you will be able to unhide it, or the other setting at which point it will be viewable.

Resources