userform

Getting the value of a listbox to dynamically change with worksheets

孤者浪人 提交于 2019-12-12 01:36:50
问题 How can I get the value of a listbox in a userform to dynamically change when the user changes the value of a another list box in the same userform. The main portion that is giving me trouble is lstMonth. The value of lstMonth should equal the months, which correlate to the data in different sheets that will show in the first listbox. I will provide a picture of the form and data so that this all makes more since. Code Option Explicit Private Sub cmdCalc_Click() 'declare variables and assign

Incrementing cell row in excel

我怕爱的太早我们不能终老 提交于 2019-12-12 01:29:31
问题 I have a UserForm that's going to submit data from the fields to columns A, B, and C, but I need it to move down and fill in the next empty row every time a user hits submit. This is what I have so far, I don't know what I would put in to make it so it would go from A2/B2/C2 to A3/B3/C3, etc. Private Sub Submit_Click() Dim LastRow As Object Set LastRow = Sheet1.Range("a65536").End(xlUp) Sheet1.Range("A2").Value = MatchNum.Text Sheet1.Range("B2").Value = TeamNum.Text Sheet1.Range("C2").Value =

VBA - UserForm with multiples TextBoxes in infinite calculation loop

自作多情 提交于 2019-12-11 20:35:21
问题 I have an UserForm with 5 TextBoxes, and each time one is updated I recalculate the others. But how do I avoid a "infinite loop" as the first will recalculate second which will recalculate the first and so on... Here is a part of my UserForm's code, only the TextBox_Change(s) : Private Sub TxtNewVal_Change() If InStr(1, Me.TxtNewVal.Value, ",") Then Me.TxtNewVal.Value = Val(Replace(Me.TxtNewVal.Value, ",", ".")) 'recalculate values If Right(Me.TxtNewVal.Value, 1) <> "." Then Me.TxtValEUR

Retrieve Index by Values From an Array Through a ComboBox

十年热恋 提交于 2019-12-11 18:27:33
问题 I have a transposed dynamic n x 2 array that is used to populate a combobox. The primary column alone is not descriptive enough to identify rows uniquely. I would like to use the row index to identify the untransposed column uniquely. Using both columns in the array could also be used for this but may prove problematic down the line. This question is closely related to this question. I have used Me.cbo.ListIndex = 0 to retrieve the index value. Ideally, I'd like to assign the index of the row

Using Keyboard Shortcuts with RefEdit Boxes in a Userform

妖精的绣舞 提交于 2019-12-11 16:34:23
问题 I am developing a userform in EXCEL 2016 VBA with a number of RefEdit boxs. When I use one of the MS developed userforms (like, for example, the Descriptive Statistics userform in the Data Analysis ToolPak), the user is able to use shortcut keys like Shift + ↓ or Shift + Ctrl + ↓ to make the selection. At present, my RefEdit boxes do not support this function. Is it possible to code these attributes in VBA for a typical RefEdit box? If so, can someone please provide example code? Many thanks,

UserForm and Range

浪尽此生 提交于 2019-12-11 16:08:09
问题 I have an Excel sheet with column D (column 4) being a dropdown list for every row with 2 choices : Yes No When I click No, I have a Userform pop up with a simple "text zone" asking to enter a value and a "Submit button" to validate. When the "Submit button" is clicked, I want the value from the "text zone" to be implemented into the cell to the right : offset(0,1). Example : D5 : "No" -> "Enters 5 in Userform" -> E5: "5" Here is my code so far : Worksheet : Private Sub Worksheet_Change(ByVal

How does one get the UserForm where MSForms.ComboBox Object is located?

天大地大妈咪最大 提交于 2019-12-11 15:42:26
问题 Hi got a Class Called "FilterLine", It consist of 3 ComboBoxes which are filled depending on all other already selected filters. Here a simplification of the code: Option Explicit Public WithEvents Filter As MSForms.Combobox Public WithEvents Operator As MSForms.Combobox Public WithEvents Options As MSForms.Combobox Public index As Integer ' This sub adds a new FilterLine and formats it Public Sub Add() ' Do Stuff with form in which it is embedded frmFilter.Height = frmFilter.Height + 50 End

Clear cascading ComboBox on reselection

怎甘沉沦 提交于 2019-12-11 13:58:32
问题 I am in the process of creating a user form in excel that uses several ComboBox'. The first ComboBox lists values from column 1 of a table and the following ComboBox' lists values from the following columns. ComboBox 2 onwards also only lists values depending on the preceding box. All ComboBox' show unique values only. Here is the current code I am using: Option Explicit Private Sub ComboBox1_Change() Call cValues(ComboBox1.Value, ComboBox2, 2) End Sub Private Sub ComboBox2_Change() Call

Userform activating the sheet where it was initiated first

旧时模样 提交于 2019-12-11 13:39:30
问题 I have a userform with few buttons for different macros to run. At the end of execution of macro it hides the userfrom. I have resablled the close button of userform with the following code: Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) ' Prevents use of the Close button If CloseMode = vbFormControlMenu Then hmm Cancel = True End If End Sub hmm hides the userfrom. Now the challenge is suppose there are 3 workbook. Workbook A: The macro enabled workbook in which I