Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
User Form Problem
I have done some reading on using User Forms within VBA. I am taking data from the form and putting it to an Excel worksheeet. Here is the code I have so far... This all works... Private Sub cmdSaveData_Click() Dim LastRow As Object Sheets("DailyData").Select Set LastRow = Sheet1.Range("a65536").End(xlUp) LastRow.Offset(1, 0).Value = txtDate.Text LastRow.Offset(1, 1).Value = txtRawPounds.Text LastRow.Offset(1, 2).Value = txtRawSolids.Text LastRow.Offset(1, 3).Value = txtFrenchFryPounds.Text LastRow.Offset(1, 4).Value = txtBatterPounds.Text LastRow.Offset(1, 5).Value = txtFrSpPounds.Text LastRow.Offset(1, 6).Value = txtUnFrSpPounds.Text LastRow.Offset(1, 7).Value = txtBakedPounds.Text LastRow.Offset(1, 8).Value = txtFrenchFryOil.Text LastRow.Offset(1, 9).Value = txtFrSpOil.Text LastRow.Offset(1, 10).Value = txtBatterOil.Text LastRow.Offset(1, 11).Value = txtBatterPowder.Text LastRow.Offset(1, 12).Value = txtFrenchFrySolids.Text LastRow.Offset(1, 13).Value = txtBatterSolids.Text LastRow.Offset(1, 14).Value = txtFrSpSolids.Text LastRow.Offset(1, 15).Value = txtUnFrSpSolids.Text LastRow.Offset(1, 16).Value = txtBakedSolids.Text ' <---------Question Area--------- Unload Me End Sub The User Form will be compased of six tabbed pages of input, the above is from the first page. I need to know how to write the code to have the LastRow.offset(1,17) do a calculation based on adding the pounds from the production lines (Offset 1,3 throught 1,7 above) and dividing by the raw pounds (Offset 1,1 above) I have tried several things, but I always seem to get an absolute reference and the next new row has the same result as the previous existing row. Thanks for the help in the past, I know this is something I will probably slap my forehead and so "Dummy!" -- DCSwearingen ------------------------------------------------------------------------ DCSwearingen's Profile: http://www.excelforum.com/member.php...o&userid=21506 View this thread: http://www.excelforum.com/showthread...hreadid=496826 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
User Form Error | Excel Discussion (Misc queries) | |||
Dialog & User Form | New Users to Excel | |||
Positioning 2 User Forms | New Users to Excel | |||
Printing Part of User Form | New Users to Excel | |||
Trying to delete form border, and it deletes all borders | Excel Discussion (Misc queries) |