Hide & Show UserForm Controls

Dec 13, 2006

I need some code that will do the following in a UserForm:

If option1 is selected = textbox1 is visible, textbox2/combo1 is hidden
If option2 is selected = textbox2 is visible, textbox1/combo1 is hidden
If option3 is selected = combobox1 is visible, textbox1/textbox2 is hidden

View 5 Replies


ADVERTISEMENT

Toggle Show & Hide Controls In Range

Oct 27, 2006

Having a problem with a survey I'm creating in Excel.

I have a question with a Yes/No response cell. I want to show/hide several rows below it. The problem is that these rows also contain 6 option buttons, which I also need to hide/show depending on the response cell.

Is there a handy way to hide all of these shapes/controls in the defined range, and then "unhide" them if the cell value changes back to "Yes"?

View 7 Replies View Related

Hide Controls On A Userform

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

Show Current Row Columns UserForm TextBox Controls

Oct 1, 2006

I have a spreadsheet that has a userform attached to it with text fields that enter additional data regarding each record. The userform takes these additional 5 fields and inserts them back into the spreadsheet, the final information to be exported back into Access. ( There are of course other ways to do this, but this is how my supervisor wants it done!)

My problem is that now that I can scroll through the spreadsheet without closing the userform, the userform doesnt show the current row's information as I scroll or change rows on the spreadsheet. It will only show the information that was in the row that it was on before i switched back to spreadsheet.

View 9 Replies View Related

Hide UserForm Via Top X & Show Another

Dec 29, 2006

I bet you're getting sick of the "X" questions, and I have done an exhaustive search but the search filter kills searching for (X) or 'X' or "X" .. but nothing I did find is what I am looking to do. I have any # of userforms that when you click the "X" in the top right side, it will hide the userform... once.. Is there a fix to the code below to make it do it every time its clicked?

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode <> 1 Then Cancel = 1
UserForm15.Hide
UserForm11.Show
If CloseMode = 1 Then Cancel = 1
UserForm15.Hide
UserForm11.Show
End Sub

Like I said, I don't want to disable it, I tried that off of one of the posts I found and thats just plain annoying, I just want it to hide the one userform and show the other. This will do it once and then you can click it all you want and it wont do anything.. see the annoying trait above.. this lasts until you exit the program.. so the X button can be hit repeatedly though out the day. The userform 15 is visible, userform 11 isn't shown, IE not behind userform 15.

View 5 Replies View Related

Hide Userform & Show Another

Jun 1, 2007

how to creat a userform with a button (1) to show anouther userform with a button (2). you click the button on 1 and it shows 2. then when you click the button on 2 and it shows 1. I'm having a problem with the second part.

View 5 Replies View Related

Set Text & Hide Control On UserForm Show/Load

May 14, 2008

I'm trying to do is set up a form load event to initlize some controls. Here is my

Private Sub Form_Load()
'Initialize the form
lblProcessing.Visible = False
txtFileName.Text = "Enter a file name"
End Sub

At the moment, this event is not triggering. I have the code in the code behind my form - should it be in a module? PS: This site is great - it's answered a lot of my other questions so far without me having to make any posts.

View 2 Replies View Related

Hide Form Controls

Oct 24, 2007

I have form controls on my worksheets. How do I hide them? When I hide the row, the controls stay there. These controls don't seem to have that visible property like the VB control.

I'm thinking of using a validation->list instead, but then you don't see the drop down arrow.

View 9 Replies View Related

Access UserForm Controls From Another UserForm

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

Replicate Controls Within Userform

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

Loop Through Controls In UserForm

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

Disable Controls On Userform?

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

Does A Group Of Userform Controls Have A Name

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

Loop Through Controls On A Userform

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

Create Controls Of A Userform On The Fly

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

Pro/Cons Of Userform Controls?

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

Add Controls To UserForm At Run-Time

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

Looping Through Userform Controls

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

Userform Controls Empty When Add-in

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

Add Controls To UserForm With Code

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

Reset UserForm Controls

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

Multi-Page Userform Controls

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

Userform Controls Suddenly Vanished...

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

Do Userform Controls Have An Index Number

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

Controlling Colors Of Controls In Userform

Nov 17, 2003

I have a userform with 24 text and combo boxes. Aside from using the enter and exit events, is there an easy way to have the active text/combo box be highlighted in a color?

View 9 Replies View Related

Calculate 2 UserForm TextBox Controls

Jun 3, 2009

I am trying to calculate the result of two text boxes in a third textbox on a userform.

Box1 = DirectorHrs = a textbox that the user enters the number of hours
Box2= DirectorRate = a textbox that retrieves the rate from a sheet called "Rates" within the workbook upon initialise of userform.
Box3 = DirectorTotal = Box1*Box2. I want this to update when the user enters or changes Box1.

I have the following code on the change event of Box1

Private Sub DirectorHrs_Change()
DirectorTotal.Value = CStr(Val(DirectorRate.Value) * Val(DirectorHrs.Value))
End Sub

View 4 Replies View Related

UserForm Controls Not Displaying At Runtime

Feb 2, 2005

I've created several UserForms, for some reason this one won't co-operate!

Issue are:
1. Have to click the OK button 3 times for the code to execute (this does not occur when I filter through the code in debug/F8 mode).

2. Before processing I have a label and image set to visible = true that won't appear on the form at runtime (this works when I filter through the code in debug/F8 mode).

View 7 Replies View Related

Creating UserForm Controls Via Code

Jul 22, 2005

I'm making a form in excel to retrieve a number of welds. This number needs to be passed on to the next form to dynamically create an identical number of input fields (a set of text boxes and labels essentially). Any ideas on how I might do this? Is it even possible? I would like to avoid having 100 (my assumed maximum, it could get changed) sets of input fields and hiding the unused ones,

View 9 Replies View Related

UserForm Controls To Populate Certain Cells

Oct 3, 2006

I want to create a user form to allow users to put in 26 values and then have the values populate certain cells within the spreadsheet.

I have attached a sample, I know how to create the form, I'm just not sure of the coding I would need to use?

View 3 Replies View Related

Enable Specific UserForm Controls

Oct 27, 2006

I have an Excel userform that has 10 textboxes named, say, tbLabel1, tbLabel2, ... tbLabel10. They are all disabled in the beginning. Then I have a question for the user "how many labels you want" and another textbox for the answer. If the user entered, say, 6 as the answer, I want enable the first 6 textboxes, tbLabel1 - tbLabel 6. I tried using

For I=1 To tbHowMany.value
tbLabel & I.Enabled = True
Next I

View 3 Replies View Related







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