I wanted to know how do I keep a toggle button in the on(ture) position after I close the userform? How do I keep the toggle button off(false) positoin after I close the userform? In order words, once I run my macro again, I want it to remain in memory that my toggle button was in the on(true) or off(false)?
For example,I have an application that I am developing which involves some what-if analysis for some projects. There is a command button located on my worksheet. After the command button is clicked, I have include some toggle buttons on a userform for all of the various projects. If I assume that sine projects will not be used, I click the associated toggle buttons. This puts them in the on(true) position. After I close the userform and reclick the command button, my toggle buttons are all back in the off(false) position.
I have read several articles saying using a command button as a toggle button can't be done but some articles have said it is possible using the state properties.
.State = msobuttondown .State = msobuttonup
Is there any way to combine this with the onaction property so that when you press the button, it stays down and activates a macro then when you press it again it pops back up and activates another macro.
Is there a way to get a sound toggle button on excel?
What I need is a button to turn the sound alerts on and off on my spreadsheet. Ideally I'd like a button that either changed an image to the speaker image when on and the speaker image with line through it when off. Is that possible?
If not, is it possible to have a button that just says: "Sound:ON" or "Sound:OFF"?
I guess it could be done with tick boxes, or drop down options.
I have the code below for creating a stopwatch in excel. I was trying to see if there is a way to change this code to assign it to a toggle button so if you hit one part the stopwatch would start and then the other it would stop.
I need a macro for button1. The name of button one is "on" when clicked I want it to put an "X" in A1 and then change the button name to "off" When clicked again I want it to delete the "X" in A1 and change the name back to "on". When clicked again it repeats the same process.
Is there a way to change the text on a toggle button in the code below? Basically I would like for the toggle button to begin with the word "START" on it and then when clicked changed to the word "STOP". Of course then when the user clicks on "STOP" it changes back to "START".
I have a sheet in which I am using freeze panes to keep the header section always visible. I would like to be able to add a toggle button with a macro to the sheet to allow the user to turn the existing freeze panes on/off at will, without the need to navigate the menu bar itself. So far I have not been able to find any info on if/how this may be possible. If anyone has any experience controlling freeze panes via macros, etc.
I have 15 toggle buttons that are each tied to a unique value. A toggle button identifies the value as either Active or Inactive. I then want to add a command button that will produce the product of all the Active toggle button values.
For very few togglebuttons I can use a code similar to the following (adjusting for the number of buttons)
Code: Private Sub CommandButton1_Click() If ToggleButton1.Value = False Then Sheets ("CTG Calc").Range("e50 = Sheets("CTG Calc").Range("E47") * Sheets("CTG Calc").Range("E48) Else Sheets("CTG Calc").Range("E50) = Sheets("CTG Calc").Range("E47") End If End Sub
However, when I get more than just a couple togglebuttons it becomes very unwieldy to have multple If then statments for a True/False option for all 15 buttons. I know there is an easier way to do this with some kind of array function that will look at each toggle button separately anf if the togglebutton value is false will generate the product of all false togglebuttons and ignore the value of all true toggle buttons.
I have a userform with 70 toggle buttons, the buttons are arranged in 7 columns and 10 rows, hence I named each button c1r1 to c7r10.
The button captions will change, so I want to take the captions from cell contents: worsheet 'Buttons' and the range A1:A70
I can do this long hand... c1r1.Caption = Sheets("Buttons").Range("A1") c1r2.Caption = Sheets("Buttons").Range("A2") ..... c1r10.Caption = Sheets("Buttons").Range("A10") c2r1.Caption = Sheets("Buttons").Range("A11") c2r2.Caption = Sheets("Buttons").Range("A12") unitl I get to c7r10.Caption = Sheets("Buttons").Range("A70")
I guess a loop would be better. Here's my code that does not work..
I was just going to insert word 'works' for now until I get the loop to work.
I'd also have to get a loop inside this loop, ie when the column number is 1, it needs to loop through the rows numbers, before it loops to column 2.
I guess I might be able to do that, but I fall at the first hurdle, I get Error 424, object required. I guess it does not like 'buttonaddress.caption' Do I need to declare or dim 'buttonadress'?
When opening a workbook, I'd like to set a Toggle Button's value to TRUE. I already have code Workbook_Open() procedure which resides in the ThisWorkbook module. This Workbook_Open() procedure already does lots of other things. I would like to add code in Workbook_Open() that would set the Toggle Button's initial value (TRUE).
The code for the Toggle Button resides in one of the Sheet modules (not the ThisWorkbook module). I attempted to set this toggle button value using the following code (see row 10), but it does not pass the compiler due to not being a defined variable.
I would like to set the value of a toggle button when the userform is opened so that it coincides with the what columns are hidden on screen. Below is simple example which I have not tested or debugged. It was just what i was thinking.
Sub Macro2() 'if col A is hidden If Columns("A").EntireColumn.Hidden = True Then 'make hidecalcs toggle button true (sunken) Userform1.HideCalcs.Value = True
I am creating a status board at work... Kinda like an In/out board.
I created a toggle button and using it as the persons named. I want them to be able to go to the excel sheet on our intranet. Be able to click their name (toggle button) and it change the off cell from red to white and the on cell from white to green. Then they can save the excel sheet and close out for the next person.
edit: I would also need it to go back once they click it when they leave.
I have created the active x button, but so far the only thing I can do is get the 1 cell it effects to say true/false.
I have a command button that hides rows based on zero value in Col B then a 2nd btn to unhide those rows. The challenge is that as I want this code for several workbooks that will have data of varying row lengths & not all the zero values will be in the exact same place for each workbook or each month. Having done a little research on the Board (& googled) I have not found an answer to my challenge. So I am sure someone will point me in the right direction -
I am trying to make an excel toggle button and am stumped. I am trying to create a toggle button that hides the entire row if it finds a 0 in a preset range that I am calling "Alpha". I have tried this code but it's not working.
Code: Private Sub ToggleButton1_Click() If ToggleButton1.Value = True Then For Each cell In Range("Alpha")
I am trying to create a very large spreadsheet and i have got everything organized, but for easy viewing i want to have a toggle button that hides and un-hides certain sets of the columns (ie. Press down and it hides columns "B-F", "H-J", and "M-O".... then on depress it shows all the information again)
I have got some of the coding down, but am only able to get it to hide one set at a time, not all the sets. Can anyone help me out and let me know how i tell it to run multiple commands from the one press? here is the code i have already: ...
Public Sub Workbook_Open() PromotionOrNewHireForm.Show Sheet1.Select End Sub
...which works, but I would prefer to have the form hide (or unload, exit, etc.) once the toggle button in that userform is first selected. I've tried a few things but none of them have worked. BTW, the userform has two toggle buttons, which run the following:
Private Sub ToggleButton1_Click() Worksheets("Sheet1").Range("A4").Value = "Promotion" End Sub Private Sub ToggleButton2_Click() Worksheets("Sheet1").Range("A4").Value = "New Hire" End Sub
Also, once it closes, I'd like it to move on to the next macro depending on whether "Promotion" or "New Hire" is selected. Not sure if a workbook_change event is the best way to handle that.
Is there any way you can use VBA to assign a key to toggle between two different cell formats? I want to toggle a cell from white border with black text to black border with white text and visa versa, with the same key or button. I've searched the posts but can't find this mentioned.
I have a number of sub routines that manipulate data in various ways to which I have assigned various shortcut keys (Ctrl + whatever) However as there are quite a few of these I wondered if it was possible to create some sort of pop up box in which I could list the shortcuts, the box being able to be opened and closed at the users request.
I can of course do this with some sort of userform but when this is open I can't then work on the sheet. Also as this would presumably be opened from within some code, waiting for the user to click the close button then wouldn't this prevent the other sub's from executing.
Attached is a screen shot of a bit of a file I made to use daily. It needs to be used by many people and always starts out new each day. I'd like to make the comments on the right stay "full size" when the sheet is scrolled down (it needs to be able to scroll). The top 3 lines are "fixed" and don't scroll. I've tried comments ( currently ), pictures, imported pictures...everything I know to try. How can I make the comments box persist without "rolling up" when the remainder of the sheet is scrolled?