• Excel Form 2010 Total Row Question – Includes VBA

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Excel Form 2010 Total Row Question – Includes VBA

    Author
    Topic
    #477922

    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.
    Nannette

    Reply To: Excel Form 2010 Total Row Question – Includes VBA

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: