Default State For UserForm CheckBox Controls
Jun 14, 2008
I am having a little bit of difficulty find ways to effectively incorporate a checkbox panel into a form interface. What I am trying to do is all the user to select using checkboxes which of 31 separate columns will automatically be deleted or not deleted. The method I have been using is to create 31 checkboxes, and then use the value of the checkbox (true/false) to determine a value in an array, which then can be used to delete the column by a separate sub.
However, I am interested in being able to have the checkboxes start checked or start unchecked by values contained in a different array. My problem is that I am unable to reference the checkbox itself until the form containing the checkbox is opened, but at that point I don't know of a way to cause the desired checkboxes to automatically be selected without placing a command button that must be pressed to fill them in. Essentially I want to be able to open a userform that has checkboxes preselected.
View 5 Replies
ADVERTISEMENT
Dec 18, 2006
I am planning to set a RESET(command button) button in my userform,so that user can delete or change all the input data which she/he have been entered,back to the default one that I predefined.
View 5 Replies
View Related
Nov 14, 2006
The code listed below checks to see if any checkboxes are checked via a form and if they are then populate a string variable with text to build out a range to be used for a Defined Name Range in excel. The code works but I was wondering if the same functionality could be written better.
Private Sub cmbRun_Click()
Dim SelectedRange As String
If CheckBoxML.Value = True Then
SelectedRange = "Revenue!$M:$M"
Goto jump1
Else
If CheckBoxML.Value = False Then
Goto jump1
jump1:
If CheckBoxSL.Value = True Then
SelectedRange = SelectedRange & ",Revenue!$N:$N"
Goto jump2
Else...............................
View 4 Replies
View Related
Jan 14, 2009
I need to get the state (xlon or xloff) of check boxes on a worksheet. i have tried the following but unable to get it to work.
View 3 Replies
View Related
Jan 18, 2008
I want to write code for a Checkbox that when checked it fills a cell with a color, but if it is subsequently unchecked, the cell color disappears.
View 9 Replies
View Related
Jan 23, 2008
I have a Worksheet_Change event like the one below. When Checkbox1 is ticked the it subtracts and when it's not, it adds:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim intValue As Integer
If Not Intersect(Target, Range("W12:X24")) Is Nothing Then
intValue = CInt(Target.Value)
If CheckBox1.Value Then intValue = intValue * -1
Select Case Target
' Apples
Case Is = Range("W12")
Logbook.Show
Range("I10").Value = CInt(Range("I10").Value) + intValue
Case Is = Range("X12")........................
View 7 Replies
View Related
Mar 12, 2008
I have a checkbox and a command button on my sheet. I want that, depending if the checkbox is marked or not, I can call two different macros. I don't know if this is possible at all or maybe can be done easier otheriwise, but this would more or less be my idea of what should happen:
Private Sub CommandButton1_Click ()
' If CheckBox1 = marked
Call MacroA
'Else (CheckBox1 = unmarked)
Call MacroB
' End If
End Sub
View 4 Replies
View Related
Mar 13, 2014
I have an excel file containing 50 sheets which we use as an accreditation test. Each sheet contains one question to which there are several possible answers. These answers (for example, A, B, C and D) are option buttons and when a user selects one, that selection is recorded as their response which is then marked. After answering a question they click a NEXT button to move on and as they move on the previous sheet (question) is hidden so they only ever see the current question sheet.
This has worked well for us for a few years, but we have just noticed some odd behaviour on ONE SPECIFIC sheet. The option button the user selects on that sheet (it is actually question 13 in the sequence) is not stored after the test is completed. However on every other sheet, the selection is stored fine - just this one sheet. The properties of all objects on the rouge sheet are the same as the other sheets. I have duplicated a working sheet and tried replacing the question 13 sheet to try that, but the problem persists.
I tried deleting that Q13 sheet and running the test without it and the same problem occured but this time on the preceeding sheet (question 12) which suggests it is not the actual sheet that is causing the problem.
This is the vb code we have on each sheet
Option ExplicitDim Response As StringDim q13 As IntegerPrivate Sub cmdQ13_Click() q13 = 0
If optq13a.Value = False And optq13b.Value = False And optq13c.Value = False And optq13d.Value = False Then
Response = MsgBox("You must answer Question 13 by selecting one of the options!", 16, "More Information Needed !")
[Code] .....
So in this example there are 4 option buttons and 1 command button. It is no different to the other 49 sheets
View 2 Replies
View Related
Jan 18, 2008
In my spreadsheet the user has the option to put in a numerical value into different cells, which will update (add to) another. So if we have an initail value of 20 in "I10" and the user puts in 20 in "W12", then I10 will display 30.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("W12:X24")) Is Nothing Then
Select Case Target
Case Is = Range("W12")
Logbook.Show
Range("I10").Value = CInt(Range("I10").Value) + CInt(Target.Value)
Case Is = Range("X12")
Logbook.Show
Range("J10").Value = CInt(Range("J10").Value) + CInt(Target.Value)
Case Is = Range("W13")
Logbook.Show.................
View 6 Replies
View Related
Jan 1, 2007
I have a sheet with 550 checkboxes (form toolbar). I want to be able to reset the boxes to unchecked with a button. I found an example here but I seem to need the label (Ex: "Check Box 1")
Sub UnCheckit()
ActiveSheet.Shapes("Check Box 1").ControlFormat.Value = False
End Sub
It doesn't make sense I would need to leave the label showing on the sheet, but the label seems to be the identifer for each checkbox, not the named cell. So I am a little confused how to alter the code.
So when it works it looks like:
[] Check Box 1 Click this box to indicate something
While I wanted it to look like:
[] Click this box to indicate something
(I guess control checkboxes was the way to go but we are here now.)
View 5 Replies
View Related
Oct 18, 2007
I wrote a macro so that if a checkbox is "true" it will print and if it is "false" then the checkbox will not print. I want to do that on many other checkboxes but with this approach the number of macros will have to be equal to the number of checkboxes. I was wondering if someone here by writing one macro that will do the trick and i can assign to as many checkboxes as i want. my macro is
Sub proPaintRALPEnd()
Application.ScreenUpdating = False
On Error Resume Next
If Range("l78").Value = "True" Then
ActiveSheet.Shapes("Check Box 697").Select
With Selection
.Placement = xlMove
.PrintObject = True
End With
ActiveSheet.Shapes("Text Box 698").Select
With Selection
.Placement = xlMove
.PrintObject = True
End With
Else...............
View 2 Replies
View Related
Jan 30, 2009
Lets keep it simple. I have a userform. On the userform are 4 checkboxes.
Checkbox1 is checked by default, the others are empty.
On command click I need to pass the values to a called sheet.
View 4 Replies
View Related
Jun 3, 2012
I'm trying to create an array formula that returns all the cities in a given state by imputing the state's abb in cell K2. The returned cities go into column J. California has the most cities(430) and the cities are 5000 rows deep.
View 7 Replies
View Related
Jul 2, 2007
I am trying to change the property value of all optionbuttons on userform1 via userform2's deactivate event
Private Sub UserForm2_Deactivate()
If userform1.Controls = OptionButton Then
Value = False
End If
End Sub
View 5 Replies
View Related
Aug 15, 2012
I have a userform that has nested multipages (5 in the outer page, 4 in the inner page).
On each of these multipages, I want to have the same controls (sliders) laid out in the same order - but with unique names, named after their tab location, for each control so I can use their value property later in the code.
I've designed the layout and named all the controls on my first sheet (e.g. Slider1Outer1Inner1). I now need a way of automating the replication of these across the other 19 sheets (including the nested inner multipage!); so that equivalent slider for example would be called Slider1Outer1Inner2, Slider1Outer1Inner3 etc.
I'm not sure about coding VBA to act on items within VBA...
VB:
" For each multipage in outer
For Each multipage In inner
For Each Object In current multipage
Copy inner.object -> Next multipage
Inner.object.name = CurrentOuter & CurrentInner & CurrentSlider "
View 2 Replies
View Related
Nov 17, 2008
What's the best way to hide controls on a userform? I have a userfrom with 2 datepicker one for start date and one for end date. I want them hidden until I use checkbox and check it to appear. I am using this code but nothing is work.
View 2 Replies
View Related
Jan 23, 2009
I have taken this code from Access and trying to use it in Excel to lock all the TextBox, ComboBox & CheckBox on the form.
View 2 Replies
View Related
Jul 18, 2012
How to disable different parts of a userform?
I dont really want to go through each control as I reckon it will be handy code to have in the future if I need to add more but so far my code is:
Private Sub UserForm_Activate()
With Sheet2
n = 3
[Code].....
View 2 Replies
View Related
Jul 11, 2008
I have a number of TextBoxes across the page, all set to Visible=False.
If these get filled with data then I need to set Visible=True.
Rather than hard code this individually for each one (which is not a problem, it just looks untidy), can I select each row as a Group (whilst designing the form, not in the code) and then set that Group to Visible=True ?
View 9 Replies
View Related
Nov 4, 2009
I have a userform that contains several textboxes, checkboxes, and comboboxes. There are also some command buttons, one of which says clear all. What I want to do is loop through the controls and clear the contents or change the value to false, depending on the type. I can do this by type the name.value = "", but there are alot of controls. If possible, a loop would be much more effecient.
View 9 Replies
View Related
May 18, 2006
I am trying to create some controls in a userform on the fly based on the data in a sheet. The part of my code is the following:
summaryForm.Controls.Add bstrProgID:="forms.label.1", Name:="LAWts", Visible:=True
With summaryForm.Controls("LAWts")
.Top = 120
.Left = 20
.Height = 18
.Width = 300
.Caption = "Weights: "
End With
Question I is that how can I connet this textbox to a click event or just to a procedure when it is clicked? I tried to use OnAction but it does not work for textbox in a userform. Question II is that how can I find the all properties of a textbox or any other controls? Is there a manuel or reference available on the internet?
View 3 Replies
View Related
Aug 4, 2006
What are the pros/cons of using Userforms with the various objects (comboboxes, textboxes,etc) compared to putting the controls at the worksheet level? Are there things you can do in one and not the other?
View 2 Replies
View Related
Oct 25, 2006
I am trying to transfer data from a worksheet to a user form, so that the end users can edit the data on the user form, save it, and the revised data is sent back to the worksheet. since the worksheet data is dynamic, i am trying to dynamically add controls in the user form. but the form displays only one data.
Set sdel = Sheets("Deliverables")
Set rStartCell = sdel.Range("A65536").End(xlUp).Offset(0, 0)
counter = Mid(rStartCell.Address, 4)
dummy = 0
cnt = 1
'copy data from sheet to the user form
With sdel
'checking if deliverables sheet has any data
' If .Range("A3") <> " " Then Exit Sub
' MyTextBox.Caption = .Range("A3").Value
For r = 3 To counter
If .Cells(r, 1) <> "" Then
Set MyTextBox = Controls.Add("Forms.Label.1", "lbl" & cnt, Visible)
MyTextBox.Top = topadd + 30
MyTextBox.Left = 20
MyTextBox.Width = 150
MyTextBox = .Range("A" & r).Value
cnt = cnt + 1
Else
dummy = dummy + 1
End If
Next r
End With
View 3 Replies
View Related
Feb 24, 2007
I have a userform with a series of textboxes used for data entry (numeric values) specifically, 3 groups with 5 text boxes per group. If the value of any text box within a group is either >= the value of a cell in a worksheet range (Benchmark, i.e. BM), then the BackColor of that particular text box changes to green.
The challenge I have is trying to loop through each set of five controls to determine if the control's value is >= to the cell's value in the worksheet range, and if that condition is met, than changing the BackColor to green.
I know there must be a more efficient way to make this happen than to write an 'If - Then' for each text box (see code below)
Private Sub Benchmarks()
BM1 = Worksheets("Sheet 1").Range("A1").Value
BM2 = Worksheets("Sheet 1").Range("A2").Value
If txtGroup1Box1.Value <> "X" And txtGroup1Box1.Value <> "" And txtGroup1Box1.Value <= BM1 Then
txtGroup1Box1.BackColor = &HFF00&
Else
txtGroup1Box1.BackColor = &H80000005 ............................
View 9 Replies
View Related
May 9, 2007
i build a userform that includes 6 columns, and use named range to to be shown in the userform.
i use simple code to call this userform.
excuting the code, the userform appears ok.
i saved my file as an addin to be able to call my userform
the problem that the userform appears empty, no data and no columns, when calling the userform from the addin file whearas the userform works fine with the named range when calling from an xls file.
any idea how to solve the problem ?
pls find the attached file
File deleted as it of no help.
View 9 Replies
View Related
Dec 14, 2007
way to allow a user to add a control to a userform without going into the VBE. Here is the situation, I am developing a userform to calculate a projected budget. I want the user to be able to select the number of controls to add, and click a command button to add them. Based on other selections that the user makes, different controls would automatically be added. Is this possible? As a follow up, will I be able to atttach code to these new controls?
View 9 Replies
View Related
Mar 4, 2008
On the event that a combobox is changed the objects on my userform that relate to the same information as the combobox need to be disabled (and made invisible)... however if another choice is made then they need to be enabled again and then the objects relating to the new selection need to be disabled.
Private Sub cbo1_Change()
Dim DisableIndex As Integer
Dim CellAddress As String
Worksheets("Matrix").activate
ActiveSheet. Range("B1").Select
Do
If ActiveCell.Value <> cboVarNamEn.Value Then
ActiveCell.Offset(0, 1).Select
End If
Loop While ActiveCell.Value <> cboVarNamEn.Value
CellAddress = ActiveCell.Address(ReferenceStyle:=xlA1)
ActiveSheet.Range("B1:" & CellAddress).Select
DisableIndex = Selection.Cells.Count
Me.FrameAddEn.Controls("label" & DisableIndex).Enabled = False
Me.FrameAddEn.Controls("label" & DisableIndex).Visible = False
'there a few other objects here that will also be disabled... text boxes, check boxes etc.
Putting an unload/load command in won't work for obvious reasons and I can't use a command button because that would require my clients to actually think of pressing it.
View 3 Replies
View Related
Dec 15, 2008
I have a MultiPage userform and I'm adding (4) control buttons - CancelButton, BackButton, ForwardButton and FinishButton. On the first page, those names are fine but when I get to subsequent pages, I get an ambiguous error if I try to name the controls the same. But the code will all be the same. What am I missing? In an example that I have, the user was able to name all the controls with the same name. What setting would control that?
View 5 Replies
View Related
Jun 19, 2009
My userform has a group of controls, four navigation buttons and a textbox. The nav. buttons have accelerator keys, Alt+N for next record and so on. I was moving the group about on a userform, when hey presto! it suddenly disappeared. When I run the form, the navigation buttons do not appear, but I can still navigate using Alt+N, Alt+P. Here's what I've done so far, trying to find out what's going on.
* I selected all controls with Ctrl+A, but there was no sign of any object in the place where the missing group should have been.
* I looked on the Object Browser (which is something I don't understand too well yet) and the navigation buttons are there.
* I hid all the controls, and showed them again, didn't help.
* The group I was moving was near the bottom of the form. I set the zoom property of the form to 50, so all controls in design view were bunched up near the top left corner; the missing group didn't appear
View 2 Replies
View Related
Dec 18, 2009
The form that I have created has a number of controls that are created at runtime. If a user triggers the event that originally created the controls, I want to be able to delete all of the controls before recreating them.
Is there a loop that can delete all of the newly created controls? I have 9 controls on the form that need to stay put but everything after those 9 controls I want to delete. Is there something like:
View 5 Replies
View Related