Change Caption Property Of Option Button

Mar 23, 2007

I have a problem with the changing the caption property of the option buttons to bold, italic and regular.

Is it some vb code you need to put in for the option buttons?

View 8 Replies


ADVERTISEMENT

Change Output Of Option Button To Caption Or Name

Jan 11, 2008

I'm a complete Excel and VBA newbie and would like to know if it's possible to change the output of OptionButtons from 'TRUE' or 'FALSE' to "1"/"2"/"3"/etc..

The name of each button is:

Rating 1
Rating 2
Rating 3
Rating 4
and so forth..


The idea is for each rating to output its assigned number such that if the user were to click "Rating 1", the result would be "1", "Rating 2" = 2 and so on. I'm trying to design a survey and these results will then be used to calculate an average rating. If this is possible, how would I need to write the code for it?

View 2 Replies View Related

Change Button Shape Caption

Feb 14, 2008

How do you references the properties of a shape? I am having trouble with 2 different types. Firstly, I have a worksheet with a group of commandbuttons (all added using the Control toolbox) and I want to loop through them changing, for example, the enabled property of each to TRUE.

Secondly, I have some commandbuttons on a worksheet (added using the Forms toolbox). How would I loop through changing, say, the text on the buttons. I used the macro recorder to try to get an idea and got the following:

Sheet1.Shapes("button 15").Select
Selection.Characters.Text = "New Text"

Although this works, it is not very elegant, how can it be achieved without selecting the button each time, but rather by directly accessing the property.

View 3 Replies View Related

Change Toggle Button Caption On 2007 Ribbon

Jul 1, 2008

I currently upgrading some add-in to Excel 2007. This one concern a toolbar or Ribbon as they call it now. I am creating a toggle button using XML

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="rxTrading" label=" Trading" >
<group id="rxDownloadStockData" label="Download Stock Data" >
<button id="rxDownloadData" label="Download" onAction="rxDataStock_Download" />
<toggleButton id="rxEnableDisableDowwnload" label="Enable Download" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>

How can I change the name of toggle button to "Disbale Download" after clicking on the toggle button? I am trying to find the answer on WROX Excel 200 VBA but I am lost.

View 2 Replies View Related

Conditionally Show/Hide Columns & Change Button Caption

Jan 22, 2009

After scouring the entire OzGrid, I have found the following two macros that partly satisfy what I want to achieve. BTW, following two macros are executed on Sheet2 and I want to achieve the following:
On Worksheet_Activate, show columns that match the criteria value in Sheet1.D4 (Sheet1.D4 contains a dropdown list with about 6 text values). In addition to that, if Sheet1.D4 value is blank then show all columns. Right now, it successfully shows columns that match the D4 value but does not work if that D4 value is left blank, instead it hides all columns in range (C:CV). So in short, to the first macro, I need to add the criteria if D4 is blank, then keep the sheet intact and don’t hide anything, just show all columns.Once on that sheet after the Worksheet_Activate event has occurred, with the second macro “ToggleColumnsVisibility” following things need to happen. BTW, currently this macro is assigned to a button (from Forms Toolbar).If cell D4 has a value, then the button’s caption should read “Show All” and when that button is pressed, it should show all columns in the range (C:CV), and the button's caption needs to change to “Show Selected”. In “Show Selected” mode, when that button is pressed, it needs to show all the columns that match the D4 value.If cell D4 is left blank, then the button's caption should read "No Action" and when the button is pressed, it should not do anything but just show all columns.

As you will notice in the header, my experience with Excel is very limited, so detailed instructions will be greatly appreciated. I am also hoping that proposed solution uses some of the efficient/effective ways of using loops such as described below (example taken from this website from this link http://www.ozgrid.com/VBA/SpeedingUpVBACode.htm)


Sub TrueOrFalseFaster()
Dim bYesNo As Boolean
Dim i As Integer
bYesNo = (i = 5)
MsgBox bYesNo
End Sub

Sub ToggleTrueOrFalseFaster()
Dim bYesNo As Boolean
bYesNo = Not bYesNo
MsgBox bYesNo
End Sub .........

View 9 Replies View Related

Change Cell Color By Option Button

Nov 22, 2006

I have a series of 12 option buttons on my spreadsheet named Opt_1 thro' opt_12. Whenever one is pressed, I want to invoke code to action the following:

change forecolor of non-selected option buttons to yellow
change forecolor of the selected option button to red
Enter in Cell A1 the number of the option button slected

So, for example, if Opt_4 was pressed, then

Opt_1 - Opt_3 & Opt_5 - Opt_12 forecolor = yellow
Opt_4 forecolor = red
Cell A1 gets the value of 4 entered into it.

I know how to do this on a user form, by putting the option buttons in a frame and then picking up the array value of the option button, but I have these directly on my spreadsheet next to 12 cells as this is more relevant to my application.

I thought of a Select - Case statement, but this will be rather lengthy. Have you any suggestions on how to tighten this code down.

View 3 Replies View Related

Option Button Properties Change Based On A Checkbox

Jun 13, 2006

I would like to set up some option buttons so that the will be become visible and enabled when a check box is checked, and the opposite when the same checkbox is not check. This is my problem

Private Sub cbpDiscAlum_Click()
Dim myOption As Control
Dim myValue As Boolean
myValue = cbpDiscAlum.Value = True
If myValue = True Then
For Each myOption In pDiscounts.Controls
myOption.Visble = True
myOption.Enabled = True
Next myOption
Else
For Each myOption In pDiscounts.Controls
myOption.Visible = False
myOption.Enabled = False
Next myOption
End If
End Sub

It is the 5th command where it gets hung up: For Each myOption In pDiscounts.Controls. I am sure I am spelling both of the names correctly: the checkbox, and the group name.

View 3 Replies View Related

Option Button On Sheet 1 To Change Image On Sheet 2

Jan 15, 2007

Sub OptionButton222_Click()
With Worksheets("Beam Input")
.Shapes("Notch 1").Visible = False
.Shapes("Notch 2").Visible = False
End With
End Sub
Sub OptionButton223_Click()
With Worksheets("Beam Input")
.Shapes("Notch 1").Visible = False
.Shapes("Notch 2").Visible = True
End With
End Sub
Sub OptionButton224_Click()
With Worksheets("Beam Input")
.Shapes("Notch 1").Visible = True
.Shapes("Notch 2").Visible = False
End With
End Sub

i need to modify it so that a selection on the beam input page causes the images to change on the beam output page. Currently this code is in the module section of VBA.

View 2 Replies View Related

Add Button Caption To Cell

Jan 9, 2007

Is there a way to program a VBA button so that its cell location is known. For ex., I have a button that says "Fail". I'd like to program it in such a way that when the user clicks on it, the text "Fail" is inserted into the cell next to it. How do I avoid hard-coding the cell reference?

View 5 Replies View Related

Toggle Button Caption Between On/Off

Jan 24, 2008

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.

View 7 Replies View Related

Form Button Caption Not Showing

Aug 31, 2007

I have used the Forms toolbar to create a command button on a chart.

However, the text for the command button is hidden. If I do an "Edit Text" on the button, it shows up, but otherwise the button appears blank, even when selected.

View 9 Replies View Related

Alternate Button Macro & Caption Between 2

Apr 23, 2008

I have a worksheet with 2 buttons labelled "Hide" and "Show". As the names imply, they allow the user to hide or show parts of the worksheet. I would like to combine them into one button and have the button label and the associated macro change with each press of the button. Here is what I have so far;

Sub SHOW_LEADS()
Rows("10:15").Select
Selection.EntireRow.Hidden = False
ActiveSheet.Shapes("Button 20").Select
Selection.Characters.Text = "HIDE LEADS"
Range("A1").Select 'is there a better way to remove the focus from the button than selecting a cell off the button?
End Sub

Sub HIDE_LEADS()
Rows("10:14").Select
Selection.EntireRow.Hidden = True
ActiveSheet.Shapes("Button 20").Select
Selection.Characters.Text = "SHOW LEADS"
Range("A1").Select
End Sub

These macros change the label fine after hiding or unhding the rows but I can't find the proper terms to use to change the macro associated with the button (if there is one?)

View 4 Replies View Related

Toggle Column Visiblity & Button Caption

Nov 15, 2006

On creating a button to perform a macro, we are hiding columns.

Can the macro pick up that

If the columns E:J are hidden, then the text on the button to read 'Unhide'
If the columns E:J and unhidden, then text on the button to read 'Hide'

I am aware I can change what is written on the button via a macro, but can it see that the columns are hidden?

View 9 Replies View Related

Go To Sheet Named As Text In Button Caption

Jun 3, 2008

There is a 'Home' page with a button for each employee - clicking the button takes the user to the appropriate employee's timesheet

There is also an 'Add New Employee' button on the home page which brings up a form and allows a new employee to be added.

Each employee has only 1 worksheet (Which is created based on a blank template page)

When the 'Add New Employee' button is clicked a form pops up which ask for name, D.O.B etc. The user fills out the form and clicks ok. The template sheet is then copied, renamed to the employees name, and all relevent fields are added to the template sheet (based on the users input). A button is also generated on the home page with the employees name as a caption and when it is clicked it goes to employees timesheet.

I have almost got this working.

The only problem is this only works once, So For Example say i Add 'John' then i add 'Mary' on the home page i now have 2 buttons with 'John' and 'Mary' on them. The problem is as soon as a second employee is added (Mary), the first employees button(John) is linked to the second employee's Sheet rather than its own(Mary). and after the spreadsheet is closed the buttons dont work at all.

The link below has the spreadsheet i have made so far, you can test it out if my description doesnt make sense or you can see the code behind the 'add new employee' form:

############################################################
#### 'Add Employee' Button on Add New Employee Form ####
############################################################

Private Sub cmdadd_Click()


'check for Name
If Trim(Me.EmpName.Value) = "" Then ..............................

View 9 Replies View Related

Link Cell Text To A Command Button Caption

Sep 4, 2006

I have created a cover sheet with various command buttons linking into the available worksheets. I was wondering if it is possible to set the title of the command buttons by linking them to the text in a particular cell in each work sheet??

View 3 Replies View Related

Hide Button Or Textbox Based On Caption Across Multiple Sheets

Oct 16, 2009

I have a workbook with 31 sheets. Each sheet has 15 textbox button that call macros.
I would like to hide 1 textbox on all sheets until another macro is called. I know how to get the textbox names to be able to hide them, But because these text boxes were copied most of the are the same name, however on severl sheets they are different names "Textbox 4 on most sheets but it could be textbox 34 on others. The ones I want to hide all have the same text label. Is it possible to get VBA to return the label text.

View 8 Replies View Related

Change The Caption Of OLEobjects Label?

Aug 5, 2014

I'm trying to change the caption of a label (OLEobject) and it is not working so far :

[Code].....

View 2 Replies View Related

Label Caption Change... Run Code

Sep 30, 2009

I have just noticed that there is no defult event for the running code after updating a label caption. I would like to have like a textbox does (Change,AfterUpdate). to run code on the label caption change. could it be done with activex?? can it be done at all.??

View 2 Replies View Related

Change Caption In Modeless UserForm From Another

Feb 2, 2008

Background: I currently have an some VBA code that will kick off a series of calculations on a remote server (7 calcs). I am showing a modeless form, to allow the user to continue to work in Excel while the external calculation is taking place. The code checks every few seconds (using .OnTime) to check the status of the calcs, and as one finishes, it starts the next calc, and updates the form (ie - "Running Calc #3 of 7", etc).

'Do calc
'Finish calc
frmProgress.labMessage.Caption = "Running Calculation: 'Revenue'"
'Do another calc
'Finish another calc
frmProgress.labMessage.Caption = "Running Calculation: 'Labor'"
'etc...

Problem: when I change the label on the form, it gives the form focus. So, if the user is in the middle of doing something, they are suddenly stopped, and have to click back on the spreadsheet to continue.

Questions: Is there a way to update content (label) on a form, without that form getting focus? If not, is there another way to provide updated feedback without disrupting what the user is doing? My fallback is to simply not update the form with progress reports, but since the calcs can take 5min or so, it would be good if they knew things were progressing.

View 3 Replies View Related

Change Caption Of Label & UserForm

Jun 20, 2008

I present a form (a calendar) twice in my routine to the user but I want to change the Caption of the Label on each pass?

e.g.

The first time it's displayed: 'Please select a start date' (calendar closes & goes off and does stuff)
... and on the 2nd display: 'Please select an end date'.

View 7 Replies View Related

Change Chart TextBox 1 Caption Via Macro?

Jul 18, 2014

[Code].....

I am trying to edit a textbox caption in an active chart with a macro and cannot figure out the correct way to reference the text property. I have been successful in editing other items within this chart via the complete code below (i currently have textbox edit commented out)

[Code].....

I know i can set it up with a helper cell to have the textbox reference a range (that updates with the text i want) but i'd to try and edit the text without the use of helper cells to try and make this a little more break resistant.

View 5 Replies View Related

Macro To Change ActiveX Label Caption?

Mar 2, 2014

I needed to put a Checkbox on a Worksheet. The standard Checkbox options in Excel FormControl and ActiveX Control were too small. I found a work-around using the following macro attached to an ActiveX Label that was formatted as Wingdings font. The macro basically changes the character from a empty box Wingdings Chr(168) to a checked box Wingdings Chr(254) when the user clicks on the label.

Private Sub Label1_Click()
If Label1.Caption = Chr(254) Then
Label1.Caption = Chr(168)

[Code]....

But I get this error on an ErrorHandler that I have included in the macro. "An error has occurred. Error number =438. Error Description=Object doesn't support this property or method."

View 3 Replies View Related

Change Form Caption To Cell Value Or Variable

Sep 24, 2009

it's possible to change the caption (title) of a user form to a variable or cell value? Or does it always have to be hard coded?

View 2 Replies View Related

VBA - Change Caption Of ActiveX Checkboxes Using A Loop

Jan 24, 2013

I am trying to change checkboxes caption name using a loop so that I don't have to change them individually. Here is a simplified example of what want to do:

1) I save the caption names in a array
2) I run through a loop to rename each checkboxes using the names saved in the array

Sub change_Checkbox_Caption
Dim MyArray(1to3) as string
Dim IndexMyArray as integer
MyArray(1) = "YES"
MyArray(2) = "No"
MyArray(3) = "Maybe"

[Code]...

View 2 Replies View Related

Change Of Toolbar Item Caption Does Not Work

May 14, 2009

I am trying to change the caption of a toolbar item but for some reason it does not work.

Application.CommandBars("Format").Controls("Item...").Caption = "I&tem..."
However,

Application.CommandBars("Format").Controls("Item...").Delete
for example works just fine

View 9 Replies View Related

Change Caption Of Dynamically Created Label

Jun 26, 2007

For a form that dynamically creates a series of text boxes and labels, does anyone know how to change the caption of a dynamically created label to display the value of a cell in a worksheet? The cell in the worksheet changes according to input on the text boxes. In the form's code, I have:

Dim newLblFreq As MSForms.Label
Set newLblFreq = Me.Controls.Add("Forms.Label.1", "lblfreq" & i, True)
newLblFreq.Caption = Range("V" & i).Text & " Hz"

But once the label is created, the caption won't change, even if Range("V" & i) changes...............

View 6 Replies View Related

Change Label Caption Based On Scrollbar Value

Feb 1, 2008

I'm amtepting to populate some labels from some predefined strings based on the scrollbar value. I have these codes:

Option Explicit
Public Meddelande1 As String, Meddelande2 As String, Meddelande3 As String, Meddelande4 As String, Meddelande5 As String, Meddelande6 As String, Meddelande7 As String, Meddelande8 As String, Meddelande9 As String

Private Sub UserForm_Initialize()
On Error Resume Next
Workbooks("Kontrollsystemet.xls").Close SaveChanges:=False
Application. ScreenUpdating = False
Workbooks.Open "V:allaBeredningKontrollsystemetKontrollsystemet.xls", ReadOnly:=True
Sheets("Meddelanden").Activate
Meddelande1 = Range("B2").Text
Meddelande2 = Range("B3").Text....................

View 2 Replies View Related

Change Label Caption When Textbox Selected

Jun 11, 2008

I'm buildng a userform for data input.

As an aid, I have a label at the bottom of the form and when a person tabs onto a textbox that labels then states what you are supposed to input into that textbox along with an example. When you tab onto another textbox the caption on the label changes to give another explanation and example.

I attempted to insert an if statement into the userform which states that if a textbox is enabled then the caption of the label = "Example"

If textbox1.enabled = True Then label1.caption = "Explanation 1, Example 1"
If textbox2.enabled = True Then label1.caption = "Explanation 2, Example 2"
End If
End If

View 5 Replies View Related

Inserting A Button With VBA - TopLeftCell Property

Mar 21, 2014

I'm having a problem that I really can't figure out.

My macro is as follows:

Code:
Sub Tester()
Dim rng As Range
Set rng = ActiveSheet.Range("B3")

[Code]...

My problem is that when I click the button and activate the macro "msg" it returns the row value of the button as 1, when it should be 3 as I placed the button into cell B3.

View 2 Replies View Related

Set An Option Button By Name

Oct 8, 2009

In Excel 2003 VBA, what is the syntax for controling an Option Button or Checkbox by name or caption

I have tried the following but has an error, I am sure this is a simple one.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved