Vba marco

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 10:02 PM GMT

Question

Sir I have two question regarding user form.I want to multiply four text box of user form1 with 4 text box of user form2 and add up four values from multification and store the value in a cell .


using the code, i could not get it to work .

Userform1.TextBox1.Value = Userform2.TextBox1.Value

Userform1.TextBox2.Value = Userform2.TextBox2.Value Userform1.TextBox3.Value = Userform2.TextBox3.Value Userform1.TextBox4.Value = Userform2.TextBox4.Value


second question is the code below makes sheetnames appear in drop down menu.I want to select which sheet to enter data out of three sheet ?

Code: Private Sub UserForm_Initialize() Dim i As Integer For i = 1 To Worksheets.Count

   Me.ComboBox1.AddItem Worksheets(i).Name

Next i End Sub

Answer

1 - you would need both userforms open simultaneously, so they'd need to be shown with the parameter vbmodeless. To multiply them I'd suggest storing each value in a numeric variable (integer, double, etc) and then do your math with the variables.

2 - Should work fine - what's the problem?

Advertisement

©2017 eLuminary LLC. All rights reserved.