Option Button (active Control) Code To Perform A Calculation

Nov 18, 2008

is it possible to choose an option button which will then perform a calculation on a cell reference? I’m trying to deduct a percentage from a total when an option button is highlighted.

View 5 Replies


ADVERTISEMENT

Place Code Behind Userform: Active Control Colored

Feb 23, 2007

I have created a user form and I am trying to get the active control colored. I am using the code from Mr Excel's VBA book - starts on page 454, and I have entered all the code, but now when I activate the user form I get an error ....."Compile Error. Invalid attribute in Sub or Function." and when I click OK, it takes me to this line of code.....

Private WithEvents objForm As clsCtlColor

In the book, this is where I am supposed to start entering the code "behind the userform" rather than in the class module. So, I assume this means that this code goes with all the other code for the user form (in VBA project click on form, then view code). Am I wrong? Should I be adding a module? Not sure what I am doing wrong.

Here is the code I have in the class module....

Public Event GetFocus()
Public Event LostFocus(ByVal strCtrl As String)
Private strPreCtr As String

Public Sub CheckActiveCtrl(objForm As MSForms.UserForm).......

View 9 Replies View Related

How To Perform Calculation On Pivot

Dec 25, 2013

it is more than 5 days now that I try to perform calculation on pivot.

problem: I have one cell that I set to show values as "% of the column total" when try to perform the calculation through insert calculation field with other cell the calculation is not correct/ it seems like the "show values as "% of the column total"" disturbing the calculation resolve this thing

View 14 Replies View Related

Perform Calculation Depending On Cell Value

Dec 14, 2012

I'm developing a financial spreadsheet.

I've got a cell "Taxable Income" and another cell "Tax on Taxable Income" in sheet2.

When I enter a value in "Taxable Income" I want "Tax on Taxable Income" to automatically calculate based on formulas in sheet1. I don't know how to get "Tax on Taxable Income" to determine which formula to apply from the different tax brackets.

For example:
If taxable income is <$18201, tax = $o
If taxable income is between $18201 and $37000, Tax on Taxable Income =0.19*Taxable Income
If taxable income is between $37001 and $80000, Tax on Taxable Income =3572+0.325*(Taxable Income - $37000)

The idea behind having formulas in a different sheet is so over time when tax rates/brackets change I only have to change the formulas on one sheet.

I know how to use basic AND, IF statements e.t.c but I can't seem to get the syntax right for this to work.

View 1 Replies View Related

Can A Cell Contain Text And Perform Calculation?

Nov 17, 2009

I would like to have a cell in which there is descriptive text and the results of a calculation. For example, in row 2, I want to state the current total number of items in inventory at the top of the sheet in the center of the used cells.

Inventory Total is: SUM(A4:A64,000) as of: Date()

I can't merge cells or manipulate the text in such a way to neatly bring the text and calculation together. And there are actually 2 calculations in the example above. One to SUM the items and one to add the date.

View 5 Replies View Related

Using Function To Perform A Calculation If Certain Values Are Met, Otherwise Return 0

Jun 10, 2006

As an example, cell values as follows.

A1 = 1, 2 or 3, B1 = 2.5

Is it possible to say, if A1= 1 then make C1 equal to B1+4, otherwise return the value of 0?

View 6 Replies View Related

Determine Active Control On Multipage Control

Oct 4, 2007

How do I determine which control the user is currently modifying on a multipage form (either changing, enterying or exiting the specific control). when I use "userform1.activecontrol" i get "multipage1" as the control name but I need the actual control on the specific active multipage. (also the .TABINDEX is for the multipage regardless of the on-page control) I use a generic data-field change SUBroutine so need the control name (and the TABINDEX) to provide my SELECT CASE. (so every fieldname_CHANGE calls the same SUB [with no parameters])

View 3 Replies View Related

Manual Or Automatic Calculation Option Using VBA

May 26, 2006

Is there a way of using VBA to check which calculation option is on - "automatic" or "manual" ?

View 3 Replies View Related

Control Option Buttons On One Sheet?

May 20, 2014

I have a spread sheet and I want to have multiple option buttons on it. but for separate things

e.g. I need roughly 50 option buttons. however. I want about 25 groups of them.

so I want 2 buttons next to a cell where user can select one. then I want 2 more on cells below where user selects one for a different question

but at the moment, every single option box copies every other box when I changed the format control cell reference. even though I haven't copied and pasted them!

View 9 Replies View Related

Perform Copy / Paste Between Sheets With Command Button And Add Message Box To Indicate Invalid Action?

Aug 23, 2013

I am trying to develop a system to allow me select different parts from multiple sheets and then add them into a bill of material on a separate sheet.

[URL] ...........

I have written some VB script the best I can and it includes a 'commandbutton' to make it easy for the user of the workbook to use.

This is how it works:

Go to 'Step 1 - Manifold 8640' tab and highlight one of the yellow cells.Once you have selected a yellow cell, you then click the 'select' button above.The value (along with other values) are copied to the 'Smart Calc' sheet.Then you go to 'Step 2 - Gland Plate' tab, select a yellow cell, click the 'Select' button.Notice how the 'Step 2 - Gland Plate' value is entered into a different group in the 'Smart Calc' sheet - this is great................BUT

The issue I am having is:

If the user goes to 'Step 1 - Manifold 8640' tab, highlights the desired yellow cell then presses the 'Select' button twice, it will add two lines of data in the relevant 'Step 1 - Manifold 8640' section....This is ok.But when the user clicks a third time, the 'Step 1' data will overflow into the 'Step 2' section of the 'Smart Calc' tab...because the script tells the data to look for the next available line to write to. This is what I am trying to avoid!

Instead, i would like a message box to popup to indicate to the user that they cannot add anymore data into into the 'Step 1' or 'Step 2' sections of the 'Smart Calc' tab until they clear the data from within the relevant section in 'Smat Calc'.

I would like to set limits on where each 'Step 1' or 'Step 2' data is written to the 'Smart Calc' sheet (so it is within its relevant section). As you can see the script basically looks for the next available cell but this isn't really good when the data 'overflows'.

Note that you are able to highlight the yellow cells in the 'Smart Calc' tab and press the delete key, it will delete the data to clear the line. That is how i designed it to work so if the user makes a mistake they are able to just delete the relevant line and enter new data.

View 1 Replies View Related

Changing Groupname And Other Properties In Option Buttons From The Control Toolbox

May 31, 2006

Im trying to create many option buttons on my sheet and then change the GroupName and Name properties but im having no luck in accessing the properties. Here is the code ive got at the moment, could someone tell me how to access these properties. Shown below is a small section of the code, if you require the full code i will happily provide it. This is my first post and im not sure if this code tag thing has been done properly:

n = 18
Call Section_Header
Range("D" & n - 1).Value = " Case"
For i = 1 To UBound(Name_Case, 1)
Range("D" & n + i).Value = Name_Case(i)
Range("M" & n + i).Value = Cost_Case(i)
ActiveSheet. OLEObjects.Add(ClassType:="Forms.OptionButton.1", _
Left:=628, Top:=(n - 1) * 15.75 + (1 * 6) + (i - 1) * 15.75, Width:=46.5, Height _
:=15.75).Select
Next i

View 2 Replies View Related

Active / Deactivate Option Buttons Based Upon Check Box Status?

May 31, 2014

I have a survey template with several options buttons (made from Form toolbar and grouped by Group Box).I would like to have a check box that would activate these option buttons for specific question if unchecked and vice versa.

I have copy & paste below formula in VB, but is shows 'Run time error 424' & when I Debug it shows 2nd line highlighted by yellow colour.

VB:
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then [code]....

View 3 Replies View Related

Excel 2003 :: Macro That Clears Option Buttons Made With The Control Toolbox?

Sep 26, 2013

I created some excel 2003 spreadsheets to use for Fire/Police dispatchers. I have a series of yes/no option buttons that were created using the control toolbox. I have a macro that clears all the blanks where text is added, but want to add a line that clears the option buttons also.

View 14 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

Active X Calendar Control And Password

May 21, 2009

Having created a spreadsheet with active x calendar control I find that if the worksheet is password protected I'm unable to use the control to enter a date. Take the password off and it works fine. Is there a way around this??
The password for the attached example is "date"

View 4 Replies View Related

Deleting An Active Control Along With The Cell

Jul 10, 2009

I have created a spreadsheet that uses checkboxes. When deleting a particular row that is no longer needed, it leaves the check boxes. Is there a way to link them to the cell (which contain formulas) so when the row is deleted, I don't have to delete each individual check box.

View 9 Replies View Related

Active X Control Stops Working

May 16, 2006

I have joined out of desperation relating to a problem with an Active X control inserted into a userform. This control accesses and returns data from an instrument on the RS232 PC comms port. All works well until I try to save, copy or print the workbook using usual VBA code, then mysteriously the code just stops, and Excel needs to be restarted again. It seems to just get lost!

View 2 Replies View Related

Option Button Grouping

Dec 10, 2013

I'm trying to replace a bunch of checkboxes on a sheet with a bunch of Form Control Option Buttons. The problem I'm having is every option button I add seems to be grouped with all of the rest of my option buttons. If I add buttons 1 & 2, I need those 2 grouped together, and when I add 3 & 4, I need those grouped together. Currently it's grouping all 4 buttons together so 1 - 4 are linked, but I need 1 & 2 linked together, and 3 & 4 linked together. I've tried grouping, but it still doesn't function how it ought to.

View 13 Replies View Related

Option Button To Post Value

Mar 18, 2009

Not sure how too do this, here is a simple example of what I want too do. Just using different buttons to post a number.

View 6 Replies View Related

Option Button Usage

Jan 2, 2010

I have a worksheet where the user selects between two option controls, which are mutually exclusive. when they toggle an option, a user form pops up, depending on which option they selected, and askes them for a number, which is used in a calculation elsewhere in the page. The user form has a cancel button, in case they decide to back out. If they cancel, I want the option buttons to reset back to their original state.

The problem I'm having is that when I code it, if you select cancel on the user form, it causes the option to revert back to it's previous state, but that triggers the selection of the option again, which pops up the form, making a neverending loop! Is there a better way to do this? I tried it with a toggle button, with the same results.

View 14 Replies View Related

Option Button Group Value

May 14, 2013

I have user form with 5 OptionButtons in one group called Group1 and another 5 in Group2.

I need that those 5 OB in each group had value from 1 to 5 and then user selects one OB it will inset that value (not TRUE or FALSE) into cell and same with Group2.

Private Sub CommandButton1_Click()
Cells(ActiveCell.Row, "E").Value = Need value of Group1
Cells(ActiveCell.Row, "D").Value = Need value of Group2
End Sub

View 5 Replies View Related

Multiple IF With Option Button?

Sep 18, 2013

I am looking for Multiple IF formula that linked with options button.

If D10=True 16+(C12*2.10)
If D11=True 14+(C12*1.6)
If D12=True 12+(C12*1.3)
If D13=True 10+(C12*1.15)
If D14=True 16+(C12*2.10)
From D10 to D14, there is always one True and others are false.

View 2 Replies View Related

Option Button Reordering Itself

Nov 7, 2013

Working on a project for a client, and I have two option buttons set up on the spreadsheet, grouped together with a frame and linked to the same cell. Working on the sheet on my computer, the button on the left gives me a value of "1" and the button on the right is "2". When I email the spreadsheet to my client, the buttons reorder themselves, so that the button on the left gives him a value of "2" and the button on the right is "1". Is there a way to prevent this?

View 1 Replies View Related

Option Button Should Appear When Cell Has A Value

Aug 11, 2008

I am trying to make an option button visible only when a cell has a value, I understand that this will have to be done in VBA. So I have a value in C10 on page "Edit" and I only want my option buttons to appear when this cell has a value.

View 9 Replies View Related

Clear Option Button

Jan 26, 2007

In ThisWorkbook Userform2 is triggered upon a double click

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)

UserForm2.Show
End Sub

Userform2 has Frame1 (Option Buttons 1-6) and Frame2 (Option Buttons 7-12)

Private Sub OptionButton1_Click()

Call ProjectBuildings
Range("A1").Select
End Sub

Private Sub OptionButton10_Click()

Call BondIndustrial
Range("A1").Select

End Sub

The user can click away and things work great. The macros that are triggered search a number of Workbooks and individual Worksheets looking to select either of two (hence the two Frames) specific items.

If the user clicks any Option Button in Frame 1 (works) then any Option Button in Frame 2 (works) then goes back to the same Option Button in Frame 1 (nothing) I have a problem.

How do I clear the first Option Button in Frame 1 after the user selects another Option Button in Frame 2?

View 4 Replies View Related

Uncheck Check Box + Check A Option Button Using Command Button

Aug 20, 2009

When I press a command button I want to:

Uncheck a checkbox made with Control Toolbox

Check a particular Option Button within a group box made with the Forms Toolbar.

EDIT: Clarification, I want both things to happen when I click one button.

View 3 Replies View Related

Identify Active Page Of A MultiPage Control?

Feb 5, 2009

How can I tell (in code) which is the current tab selected on a MultiPage?

View 6 Replies View Related

Multiple Option Button Choices VBA

Apr 4, 2013

I am working on a grading sheet for our company. I would like users to choose from an option button choice (A, B, C, D, F) for each grading category and I would like to write that to a sheet that corresponds with the graded person. The form will have next and previous buttons to move through the grading process - when previous is chosen I would like the option buttons to populate what was stored in the data sheet. I think I can mottle thru the code individually but with 60 option buttons it may take quite some time.

Can I call an option button choice by "Group"? I started coding individually, but it will take a lot of code - surely there is a more efficient answer. A picture of my form is attached at the bottom of this post.

VB:
Private Sub OptionButton1_Click()Dim Grade As String
If Me.OptionButton1 = "A" Then
Grade = "A"
Else
Grade = ""
End If

untitled.jpg

View 9 Replies View Related

Retrieve Option Button Value From Outside Userform

Aug 15, 2013

How to retrieve the option button value from outside the userform (not inside the userform).

I mean from the main module i want to retrieve the value selected.

E.g.: Optionbutton1 Optionbutton2 Optionbutton3

If i select Optionbutton1 then i want to retrieve this value from outside the userform.

For reference i have attached the excel file wherein I have created the three userforms that is:

1. password (to mask the password
2. ChaseRecons (to use the option buttons)
3. Userform (to display the logo and selet folder option).

In userform Named ChaseRecons i have created three option buttons & want to retrieve the value of these from outside the userform not from the inside.

If i use (If ChaseRecons.optionbutton1.value=true then) its working fine inside the userform but not outside the userform.

View 9 Replies View Related

Form Controls Option Button

Apr 28, 2014

I cant get this to work, it comes back with run-time error '424': object required

I am using form controls option button not activeX controls.

HTML Code: 

Sub OptionButton12_Click()
If OptionButton12.Value = True Then Range("D14").Value = "Alamo"
End Sub

Sub OptionButton13_Click()
If OptionButton13.Value = True Then Range("D14").Value = "ERAC"
End Sub

Sub OptionButton14_Click()
If OptionButton14.Value = True Then Range("D14").Value = "National"
End Sub

View 4 Replies View Related







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