I have some command buttons on a worksheet that I would like to disable, preferably make not visible, until a specific person logs in. I already have code to display worksheets, or hide them, depending on who is logged in. I would like to just add this code to the end of the login procedure, to make these buttons only visible when that person is logged in.
I have 3 cpmmandbuttons in a spreadhseet named "Controls" . viz
Trim and Edit Base DataCreateReportArchive
They are always run in the same order.
My Aim is to disable and gray out the Archive button once its assigned macro is run(by clicking it) so that it activates only next time that the workbook is opened.
I have a sheet with around 3,000 rows of data. I need to be able to enable/disable different comibinations of three checkboxes based on the value of a cell in column D as follows:
If Band says £0k - £75k then all three check boxes should be disabled If Band says £75k - £250k then the Step 1 check box should be enabled but the Step 2 and Step 3 check boxes should be disabled If Band says £250k - £500k then the Step 1 and Step 2 check boxes should be enabled and the Step 3 check box should be disabled If Band says £500k plus then all three check boxes should be enabled
When a checkbox is disabled I'd like it to appear visible but greyed out so it is obvious the option is not available, maybe via conditional formatting. I don't know if this can be achieved within any code rather than having to manually add conditional formatting afterwards?
I've attached a sample to demonstrate. Is this possible to achieve? I'm open to alternative approaches as well if this makes things easier to do. The mere idea of adding 9,000 plus check boxes if already scary!
I have an Excel 2003 program that contains macros. One of the macros hides certain command bars and disables the worksheet menu bar. On close the opposite is true. The problem is, if a user uses the disable macros when opening then the worksheet menu bar and other command bars are still available. I would like to hide all of the data sheets and display another sheet that would normally be hidden displaying a message that the macros have to be enabled for the program to work correctly if disable macros is chosen. When the enable macros are used I would like the Error page to be hidden.
I am at it again and maybe I am asking to do something that is not possible. I am trying to build a program that will allow the user some flexibilty down the road if I am no longer here to support my code. I have a workbook that contains several sheets. The sheets are labled by equipment name. The Sheets themselves contain specific data with regards to the equipment. What I want to do is as follows. Populate a user form with command buttons based off of the worksheet names. The reason for this would be if 2 years from now we add a new piece of equipment all the user will have to do is add a sheet in the workbook and the user form would reflect the new sheet with a new button. Like wise if I delete a sheet in the workbook the user form would refelect that change as well.
I'm trying to get a sheet filled in the order of the command buttons selected. It works like:
User clicks command button "A" in Sheet 1.
Macro runs that selects correct info in Sheet 2.
Info gets pasted in Sheet 3.
Repeat and Sheet 3 columns fill to the right with each command button clicked.
My issue is that I'm not sure what command to add in the macro to make it paste in the next available empty column. Right now all I can get it to do is paste over the info already there.
On a worksheet, I have several commandbuttons. For many of the buttons the name in the "name box" is different than the name in the "(name)" field under Properties.
Researching this, I found this on msdn2.microsoft.com:
An ActiveX control on a sheet has two names: the name of the shape that contains the control, which you can see in the Name box when you view the sheet, and the code name for the control, which you can see in the cell to the right of (Name) in the Properties window. When you first add a control to a sheet, the shape name and code name match. However, if you change either the shape name or code name, the other isn't automatically changed to match.
So, in my case, one button has: In the name box: "CommandButton5" In the (name) properties field: "RunProcess"
The real problem arises when I'm using code to loop through the objects on the worksheet, and build an array of the object names. I'm trying to match the name of the buttons to their click events. In the code, "btn.name" returns the name found in the "name box". The one that I want is the name in the "(name)" field under properties because this is the one that matches the click event.
How can I determine, in code, what is entered in the "(name)" field for an object?
I have a worksheet that I protect from cell deletions by disabling the command function for 'delete' using the following CommandBars.FindControl(ID:=292).Enabled = False
I execute this code in two subs:
Private Sub Worksheet_Change(ByVal Target As Range) CommandBars.FindControl(ID:=292).Enabled = False
... and ...
Private Sub Worksheet_SelectionChange(ByVal Target As Range) CommandBars.FindControl(ID:=292).Enabled = False
... all fine and good, works great only problem is...
once disabled this function is NOT re-enabled when I leave the workbook.
When the sheet deactivates I run this: ______________________________________________________________ Private Sub Worksheet_Deactivate() CommandBars.FindControl(ID:=292).Enabled = True End Sub ____________________________________________________
that works fine while I am changing worksheets within the workbook.
But it doesn't do for this function to remain disabled even after I close the workbook and then it's disabled in all the other workbooks.
What I need is to have the code re-enable this function when the workbook closes or when I activate a different workbook so that the function is only disabled within the specific worksheet of the specific workbook and it remains enabled everywhere else ESPECIALLY after I close that sheet and workbook where I have it disabled!
I tried this:
______________________________________________________________ Private Sub Workbook_Deactivate() CommandBars.FindControl(ID:=292).Enabled = True End Sub ____________________________________________________
I have a userform with, amongst other controls, a ListBox1 and a CommandButton1.
I have set the CommandButton1 to enabled = False in the properties and need it to be enabled when at least 1 item in the ListBox is selected (the ListBox is multiselect).
I have the following code, but it is not working.
Private Sub ListBox1_Click() CommandButton1.Enabled = True End Sub
Both controls are in the same userform and the names correct.
Is it possible to change the color of buttons or command buttons? There does not seem to be any place that allows this under properties for buttons, although there does for command bars. However, I've tried recording a macro as I change the color, but nothing get's recorded so I'm not sure what the syntax would be.
I have a spreadsheet with several buttons and I'd like them to change colors as they are pressed so it's possible to see what you've already done. And then, as soon as any other cell on the sheet is changed, the buttons reset color.
if you open a workbook & choose not to enable macros, is there any way to later change your mind & set macros to enabled without having to close & reopen the workbook?
Here i am attaching the excel sheet where macro is enabled. I have added macros in last spread sheet (Consolidated) everything is working fine. Whats messing is i have copied a macro for the entire workbook, which will disable Copy/Pase/Cut option to all engineers. But problem is its disabled for me as well, every time i have to delete the code for copy/cut options. I just want cut/copy option in the last worksheet (Consolidated) where i can get all the result with out touching the rest of the sheets.
I have a range of cells (A1:D5) identified within a worksheet (worksheetA) as part of a user input form.
When a certain condition exists, a routine is executed that copies a range of cells (C1:F5) from another worksheet (worksheetB) to this defined range. The copied area consists of two command buttons. They get copied and pasted no problem.
When I want to reset (blank it out of its contents) my range in worksheetA from I copy another range over of just a range of blank shaded cells. However, doing this does not eliminate the command buttons left in the range on previous pasting.
How do I delete these command buttons left from previous pasting activities when I wish to reset my range?
i try run macro with commandbutton, but it doesnt work. I insert button from "control toolbox" then i create a macro. Then i wrote this macro to "Private Sub" but it still doesnt work.
When i click on button, it only open editing macro, or select the button.
I made a userform to calculate the net weight of a package by taking the gross weight and deducting the amount of boxes included in the package. The most boxes possible is 25, so I used 25 command buttons numbered 1 to 25, so users only have to press the desired amount of boxes for the calculation to begin.
But that also means I've got 25 subs containing the same formula, and that's a bit much. I'm pretty sure this could be done more efficiently,
I have a multiple of command buttons that I want to make visible. I have the following code which I am trying to get to work. Maybe I am barking up the wrong tree.
I can't write macros, so have to create them by actually recording the process. I did that just now and then copied it into the Command button. When I run it from Tools>Macros, it works, but when I run it using the Command button it fails.
I'm trying to copy and paste values current MTD figures (P18:P39) to previous MTD area (W18:W39), but the command button fails at this selection. Cells 28-35 are blank, but I don't think this makes any difference, as I've tried the command button with those cells zeroed out.
This is what I recorded initially; this works from Tools>Macros
Sub Macro1() ' ' Macro1 Macro ' Macro recorded 04/01/2008 by Lucertola ' ' Sheets("Reconciliation").Select Range("P18:P39").Select Selection.Copy Range("W18").Select.....................
I have a workbook with some command buttons that I created a while back. The buttons used to work fine. But after installing a new computer, the spreadsheet no longer works. I can step through the code fine, but when I try to click on the button, nothing happens.
Is it possible to create a number of command buttons, depending on the number of lines on a worksheet, and then have the code attached to the command buttons execute based on the position of the buttons on the sheet. For example, if I have a button positioned over, say A3, can the code execute based on the content of another cell in the same row. I imagine that the button would have to be linked to the cell, but I cannot see how that is achieved.
I was creating command buttons and had trouble using the linked cell. I found an example on the forum here but the command buttons seem to have many different behaviors. On the attachment, "Button 1" and "Button 2" are the ones I created in Excel 2003. "Button A" and "Button B" are from an example I found on the forum.
1 and 2 can only be edited on design mode, and have the formula "=EMBED("Forms.OptionButton.1","")" by default (which yields an error when exiting the formula field). A and B can be edited at any time, and have an extra tab ("Control") on the Control Format dialog. This seems to allow the linked cell to be set and function pretty handily. Are A and B from a different version of Excel? Auto Merged Post;Here's the attachment:
In the attached workbook there is a UserForm with five (5) command buttons along the bottom of the UserForm. I'm familiar with making them the same size and aligning tops. What I'm struggling with is how to distribute them horizontally. That is, to get the same amount of "white space" between them.
I need to get the code for a "copy" command button and "select all" command button. I need both for a text box.
Scenario: I click on the "select all" command button, it selects whatever is in the text box and then the "copy" command button copies all of that. So then I would be able to paste that in another program.
I have I command buttons on the sheet and when I delete a row, the postiion of the buttons is changing. Can I make it somehow so they never move when I add or delete rows?
I've fought with this issue off and on for some time now and decided it was time to come to you for help. In the attached workbook there is a UserForm with five (5) command buttons along the bottom of the UserForm. I'm familiar with making them the same size and aligning tops. What I'm struggling with is how to distribute them horizontally. That is, to get the same amount of "white space" between them.
I have multiple Command Buttons on a spreadsheet that all require the same password when used. The password s contained in the code. Is there a way to have the password in hidden cell so if the password needs to be changed it can be change onetime and it will change all passwords. Below is the code I am using for the password.
Const strPass As String = "123456" Dim strPassCheck As String Dim lPassAttempts As Long, lCount As Long Do Until lPassAttempts = 3 lPassAttempts = 1 + lPassAttempts