473,320 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

VBA excel userform

1
Can anyone please show me how to multipy(user input) four text boxes of user form 1 with four text boxes of user form 2 and store the value in any cell .Thank you.

(Userform1.TextBox1.Value = Userform2.TextBox1.Value ) +(Userform1.TextBox2.Value = Userform2.TextBox2.Value)+ (Userform1.TextBox3.Value = Userform2.TextBox3.Value)+ (Userform1.TextBox4.Value = Userform2.TextBox4.Value) =
Jul 17 '10 #1

✓ answered by ADezii

@tomy01
The following code will multiply the Values in 4 Text Boxes on UserForm1 with the Values in 4 Text Boxes on UserForm2. For each UserForm, the Text Boxes are sequentially numbered TextBox1...TextBox4, and the result will be placed into Cell A1 of the Active Worksheet.
Expand|Select|Wrap|Line Numbers
  1. ActiveSheet.Cells(1, 1).Value = (UserForm1.TextBox1 * UserForm1.TextBox2 * UserForm1.TextBox3 * UserForm1.TextBox4) * _
  2.                                 (UserForm2.TextBox1 * UserForm2.TextBox2 * UserForm2.TextBox3 * UserForm2.TextBox4)

4 4391
ADezii
8,834 Expert 8TB
@tomy01
The following code will multiply the Values in 4 Text Boxes on UserForm1 with the Values in 4 Text Boxes on UserForm2. For each UserForm, the Text Boxes are sequentially numbered TextBox1...TextBox4, and the result will be placed into Cell A1 of the Active Worksheet.
Expand|Select|Wrap|Line Numbers
  1. ActiveSheet.Cells(1, 1).Value = (UserForm1.TextBox1 * UserForm1.TextBox2 * UserForm1.TextBox3 * UserForm1.TextBox4) * _
  2.                                 (UserForm2.TextBox1 * UserForm2.TextBox2 * UserForm2.TextBox3 * UserForm2.TextBox4)
Jul 17 '10 #2
isac
2
Thank you .Its working .I would like to ask you one more thing is there any way to multiply four text box value of user form with four cells value in spreadsheet?
Jul 26 '10 #3
ADezii
8,834 Expert 8TB
@isac
Yes, just use the Absolute Reference to the Cells in the Calculations.
Jul 26 '10 #4
isac
2
Thank you again .I have no idea on vba,just trying to learn simple userform text box calculations .I was trying to do that way input in four text boxes and out put in cell C1,C2,C3,C4 after multiplying textbox1,2,3,4,with cell B1,B2,B3,B4.


Sheets("data").Range("C1") =TextBox1*Sheets("data").Range("B1")
Sheets("data").Range("C2") =TextBox2*Sheets("data").Range("B2")
Sheets("data").Range("C3") =TextBox3*Sheets("data").Range("B3")
Sheets("data").Range("C4") =TextBox4*Sheets("data").Range("B4")

Private Sub Textbox1_change()
If IsNumeric(textbox1) Then
Sheets("data").Range("C1") =TextBox1*Sheets("data").Range("B1")
End if
End Sub
Private Sub Textbox2_change()
If IsNumeric(textbox2) Then
Sheets("data").Range("C2") =TextBox2*Sheets("data").Range("B2")
End if
End Sub
Private Sub Textbox3_change()
If IsNumeric(textbox3) Then
Sheets("data").Range("C3") =TextBox3*Sheets("data").Range("B3")
End if
End Sub
Private Sub Textbox4_change()
If IsNumeric(textbox4) Then
Sheets("data").Range("C4") =TextBox4*Sheets("data").Range("B3")
End if
End Sub
Jul 27 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: garry.oxnard | last post by:
Can anyone help me to solve a problem which involves switching from Access to Excel (then back to Access) programatically please? I have an Excel template which, on open, also opens an Access...
2
by: williamyeow | last post by:
Hi i am new to excel VB. can anyone tell me how to link userform to another userform? My concept for my program I have set up a userform with a couple of option. after the user has chose the...
2
by: hapnendad | last post by:
I am using a selection_change event on a worksheet to launch a userform that will populate the cell when a selection is made from a drop down list box on the form. Selection_change shows form if cell...
1
by: brenty66 | last post by:
I have a userform that is used as an interface for information stored on excel spreadsheets. The user enters bits of information into fields on the userform which are place on the corresponding...
1
by: Pippy Parker | last post by:
I've created a Userform within an Excel session which is populated by various pieces of info. What I'm looking to do is exported the Userform into a jpeg which I then can attach to a e - mail. ...
3
pod
by: pod | last post by:
Hello What I want to do is: from this workbook (thisWB), I want to access a userform's properties that are in another Workbook (toolWB) I can do this for worksheets, but I want to do it as...
1
by: esperanto234 | last post by:
Hi, This is the Ultimate Question!!! I already finished my program in VBA, it has a userform for filling data into Word. It has a bunch of textboxes. But people has to fill de information...
2
by: vbanewbie2 | last post by:
I want to create a Command button that will allow the user to save their work and totally close out of excel and their user form. Any ideas on the code for this.
0
by: titli | last post by:
I have created the excel worksheet from MS Access using the following code: Dim xlApp As Excel.Application Dim xlWB As Excel.Workbook Set xlApp = New Excel.Application With xlApp ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.