Enable/disable A Criterion WITHIN An Array Formula (2007)
Jun 13, 2009
I have collected some data from survey respondents, and I have the following array formula:
What I'd like to do is make the 3rd criterion -- $H$1:$H$400="american" -- dependent on whether the string value in cell A1 ("Evaluate Americans only?") is "yes" or "no".
Because, my actual situation is considerably more complex (see below), I'm looking to insert a test within the MIN array formula to check the value of A1, and calculate the answer accordingly.
I'm aware that I could theoretically create two array arguments (one with & one without the American test), and place them inside an IF function that tests the value of A1. However that isn't practical for my real-world situation...
I occasionally see array formulas with all sorts of symbols that I don't really understand in the array context (such as * and | and . ), and I'm wondering if one of those magic symbols might be the doorway to my solution.
Is it possible to enable/disable a texbox in excel which has been assigned a macro. To make it clear I'm not talking about a textbox within a userform. I understand I should really be using command buttons but I prefer the look of textboxes.
I have the following code to change the colour of the textbox (name: txtCreateInvoice) but the final line to disable the textbox doesn't work.
Sheets(1).Shapes.Range(Array("txtCreateInvoice")).Select With Selection.ShapeRange.Fill.ForeColour .ObjectThemeColor = msoThemeColorText1 .Brightness = 0.5 End With Selection.Enabled = False
On several of my worksheets, I'm asked if I want to disable/enable the macros but there are none associated with that particular worksheet- matter of fact, none of my worksheets have macros unless pivot tables count, so why am I being prompted in that way?
I have 3 checkboxes on a worksheet. I have a command button to copy/paste data that is captured from a device.
I want the data to go to the ranges that are selected by referring to the true/false driving mechanism of the check boxes.
Obviously if more than one button is checked at one time, the whole shooting match will blow up.
So....how can I allow only one check box to be active at any given time? I'm thinking perhaps a select case statement that refers to the possible conditions of true true true, true true false, true false true, etc....If that would work, how could the code be simplified?
Let's call them cb1, cb2 & cb3. Is this even possible??
I have a checkbox (checkbox1) on a userform that functions to disable two listboxes (monthListbox & yearListbox) when checked. For this, I have the following
Private Sub CheckBox1_Click() MonthListBox.Enabled = Not CheckBox1 MonthListBox.BackColor = &H8000000B MonthListBox.Locked = True YearListBox.Enabled = Not CheckBox1 YearListBox.BackColor = &H8000000B YearListBox.Locked = True
This works fine and dandy. However, when testing the userform, when I "unchecked" the checkbox, it did not undo the actions. So my question is, is there a sub to undo the actions that the above code does after I "uncheck" the checkbox. Additionally...under what event would I write this sub since I've already completed the sub for Checkbox_Click()
I need a macro to disable all cut options (ctrl^x, right click cut, cut button in ribbon above), disable drag and drop, but still allow copying and pasting (the cutting affects cell references). I've already locked the spreadsheet, but users need to be able to input information and paste information in from other workbooks. This code must also only apply to THIS WORKBOOK and not affect others. Please help with a macro for this, as well as where to paste and how to properly configure macro security settings. I'm a big excel user, but this is my first time ever with VB and macros so talk to me like I'm dumb! I've pasted links to the two codes I tried, and I think one of them enabled a macro that affected all workbooks and now whatever code I put in won't save upon re-opening. It's there when I navigate to it, but it is ineffective like it's not even there. In macro security, I've enabled all macros and have the "trust VB programming" box checked. So maybe do some damage control before re-programming. I am getting a new computer in less than a month, but I want to be able to try out the code and have it work first, and I don't want to transfer the harmful code to the new computer.
P.S. This first code allows copying and cutting, but then just disables pasting, which is not what I want. The second one works great, but disables the right click menu altogether, which is no good either. And neither allow for pasting from the outside. And this is for moderate excel users, they won't try to erase the macro. I just need to keep them from making mistakes with cutting.
I want to hide all toolbars and disable the red X upon opening of the spreadsheet, and to restore the main toolbars upon closing. That worked perfectly. (when I used the black code -see below) I added in the red code as i wanted to disable the red X as well to ensure that users will always close the EXCEL worksheet via a Macro button.
The Macro will save the spreadsheet and close the worksheet and the Private sub should restore the toolbars.
I am attempting to modify a spreadsheet so that it will enable a range on Sheet3 (I9:K42) if a check box is checked on Sheet2. If it is not checked, it will lock that range on Sheet 3 and grey (or gray, if you prefer) out that range.
I am creating a form that performs several different functions. I would like to force a sequence of these functions by enabling/disabling the controls based on a variable.
For example, a form as two buttons Button1 and Button2. By default, Button1 is ENABLED and Button2 is DISABLED. When Button1 is clicked, a macro is run, where an Enable_Button2variable is initialized to FALSE. The last line of the macro sets the Enable_Button2 variable to TRUE. Then, because Enable_Button2 is now TRUE, Button2 then becomes ENABLED.
I am trying to apply this strategy to a ComboBox, ListBox and CommandButtons. I'm not sure what event to trigger on to poll the Enable_Button2 to enable/disable the control.
I'm currently building an Excel database. This database has a few comboboxes and checkboxes that are tied to each other. If I select the combobox option of "Years", the "Quarters" combobox must be greyed out. In addition depending on which option is chosen, the relevant check boxes must be enabeled or disabled. I've written some code which runs fine, until I try and activate another macro button or if I add and rename a sheet(which is not linked to anything). What should I do? Here is a sample of my code. I have a feeling it's really obviouse but I cant see it..
I am trying to allow uses of a spreadsheet to be able to select one control button which would in turn disable another one via check boxes however the control buttons do not re-enable when the undo check box is selected.
I have converted an Excel file from 2003 to 2007. The file now has a .xlsm extension as it contains macros. I have "enabled all macros" and "trusted access to the VBA project object model". Whilst open, I have tested the macro buttons and they work.
I then close the file and re-open it, and the macro's will not work. A message appears along the lines of "macros are anabled" or "macro is not found". I have double-checked the settings and everything appears normal.
I saved the workbook as Macro enabled workbook in 2007. Also changed the security level to 'Enable all macro'. But the Macro buttons on the developer tab still shows disabled. Also not able to open VBA window with Alt+F11 key.
I have a question concerning Macros and the Disable/Enable prompt. My boss has a spreadsheet which has been used for years and he recently wanted to and did remove the macros from the spreadsheet (they were no longer necessary), but the disable/enable prompt still appears when the spreadsheet is opened. I replicated this in a test spreadsheet with a simple insert line macro and received the same results. Is there a way to remove the macros and the disable/enable prompt once they are removed? I know about setting the security to low to not see the prompt, but I would think that once the macros are deleted, the prompt should not appear any more.
I have a user that keeps a maintenance log in an Excel worksheet and sends an updated copy once a week to a board member. Two weeks ago, the board member started complaining that he was prompted to enable/disable macros on opening and became worried when my user stated that no macros were used in the book. He is now concerned that we have sent him a virus.
I know the file is clean because I've scanned it, and when I look at the file in VB, there are no modules or classes present just the Sheets 1-3 and the ThisWorkbook file. None of these objects have any code in them. My user does have some macros in PERSONAL.XLS but they are not used in the workbook in question.
No one else gets the prompt for enabling/disabling macros. Even if I set my security to prompt for any macros, I get no message. I'm convinced that there must be some setting in his Excel that is causing this individual to get this message. Is there anything else other than a macro that would cause this?
I'm trying to find out if there is a way to call the security alert to enable a macro. Let me explain...I was working on a sheet with a macro that I hadn't enabled yet. After working for awhile the option to enable it was gone and I found that I had to close the fine and re-open to enable the macro. I'm wondering if there is a ribbon or short cut icon to put in my access toolbar that will give me the option to enable/disable the macro. Seems strange that in 2003 I could to this, but in 2007 I have to close the file.
Need a code that sends emails to the intended receipients based on hold codes if Columnd J reads as YES Email formats are listed on "Email Format" tab, code should pick the required field value from the table (Hold Report).
Analyst name, Phone number are entered in the text boxes (data validation for these is desired)
option boxes are used to send email based on the selection as below
if "send initial email without attachment" is selected then emails should be sent without the attachments
if "send initial email with attachment" is selected then emails should be sent with the attachments
Attachments are usually .PDF files and are stored on users desktop with file name as .pdf
if the follow up otion is selected the subject line on the mail should be appended as *** 1st Follow-Up*** along with standard subject line
Rest of the requirement remains same for followup option (same email format is used) based on the option selected, code should be able to send emails with or without attachments. I have provided three command buttons that are intended to work as follows;
Validate data: need to validate the data to ensure that each row has atleast one email address in "TO" column and there are no spaces in the email address.
Clear Data: Should clear the existing data from the table
Send Emails: Should send emails
Standard subject line is a combination as below
Invoice on Hold for ; Invoice number: ; PO Number: ; Invoice Amount:
Note: Column H and I apply only for hold codes Qty Ord and Max Ship Amount
Currently I am working on a workbook where I am using a Save As VBA to create a folder and rename the file. The following code seems to be working fine so far with Excel 2007. Is there a way to confirm that it will work with all other versions of Excel and that my DesktopFolderPath String will work on all users machines?
In addition to these concerns, I am trying to avoid any Runtime Errors and currently, the Compatability Alert is the only thing I can see that is creating one. When it displays, in the event the user is unsure what to do, as most of our field staff is, and they select "Cancel" it displays the error Run Time Error.jpg. Can the Compatibility Alert be disabled? If so where do i add it in my code.