+ Reply to Thread
Results 1 to 3 of 3

User Form Problem

  1. #1
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    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!"
    Thanks!
    Dennis

    I am using Windows 7 and Office 2007, all of my posts are based on this.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Dennis,

    Here is the routine...

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    Thanks!!!

    I am not in the office today, but I will try this out when I return next week!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1