Results 1 to 1 of 1
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Jacksonville,NC, USA
    Thanked 0 Times in 0 Posts

    Excel Form 2010 Total Row Question - Includes VBA

    Good morning,

    I need the totals row to remain at the bottom of my sheet, except my code in the form looks for the nearest blank row to place the next record in. Eventually it catches up to my total row and places the next record BELOW the total line. How can I keep my total line from appearing as the last record?

    Thanks for the help. See attached HRDInfo.xlsm file.

    Received the code for the problem and am posting it in case any one else has the same problem. I had to code the OK button with the following:

    Private Sub cmdOK_Click()
    Dim objList As ListObject
    Dim objRow As ListRow
    Set objList = ActiveWorkbook.Sheets("HRDInfo").ListObjects(1)
    With objList.ListRows
    Set objRow = .Add(, True)
    End With

    With objRow
    .Range(1, 1).Value = txtName.Value
    .Range(1, 2).Value = txtDate.Value
    .Range(1, 3).Value = txtTraining.Value
    .Range(1, 4).Value = txtHours.Value
    .Range(1, 5).Value = txtStartDate.Value
    .Range(1, 6).Value = txtCost.Value
    .Range(1, 7).Value = txtHRDHours.Value
    End With
    End Sub

    Hope it helps someone else.
    Attached Files Attached Files
    Last edited by teachesms; 2011-07-21 at 07:57. Reason: Solved
    NMP <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    If you can't convince them, confuse them. - Harry Truman <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

Posting Permissions

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