hephensause
New Member
- Joined
- Mar 18, 2014
- Messages
- 2
Hello,
This is my first post so bare with me. I am extremely new to VBA. I am creating a database using excel. I am trying to write a code for an equation that will use numbers inputted to my spreadsheet via a userform. The equation should take three values, say A, B, and C. Run them through the formula (A+B)/2C. I want that value to be put in a specific cell in a specific row that my values A,B, and C, refer to. Right now I simply am trying
This is my first post so bare with me. I am extremely new to VBA. I am creating a database using excel. I am trying to write a code for an equation that will use numbers inputted to my spreadsheet via a userform. The equation should take three values, say A, B, and C. Run them through the formula (A+B)/2C. I want that value to be put in a specific cell in a specific row that my values A,B, and C, refer to. Right now I simply am trying
Code:
Private Sub ScanEnter_Click()
Dim c As Range, front As Single, back As Single, across As Single, ab As Single, twoc As Single, eq As Single
Set c = ActiveCell
c.Offset(1).EntireRow.Insert
Cells(c.Row, 7).Copy Cells(c.Row + 1, 7)
Cells(c.Row + 1, 11).Value = TextBox1.Value
Cells(c.Row + 1, 13).Value = typecombo.Value
Cells(c.Row + 1, 14).Value = fronttxtb.Value
Cells(c.Row + 1, 15).Value = backtxtb.Value
Cells(c.Row + 1, 16).Value = acrosstxtb.Value
Cells(c.Row + 1, 18).Value = shcombo.Value
front = frontaltxtb.Value
back = backtxtb.Value
across = acrosstxtb.Value
ab = front + back
twoc = 2 * across
eq = ab / twoc
eq = Cells(c.Row + 1, 17).Value
End Sub
[code/]
Any help would be appreciated. Thank you.