Help with Data added via a User form

skeeeter56

New Member
Joined
Nov 26, 2016
Messages
42
Office Version
  1. 2019
Platform
  1. Windows
Using the Microsoft template for Employee Attendance Tracker I have created and and modified it with help form users on here. I have the data added to a table on a sheet from a user form.this all works as I want.

The issue is that on the main sheet that data in the table is used to produce a visual calendar of the year. It colors each day depending on the dates enter and type of leave taken. Originally you entered data into the table directly your selection was done via data validation.

When you enter the data in by selecting the cell in the table from the data validation list it all works. But when it is added via the user form it indeed adds it to bottom of table. But for some reason this is not then displayed on other sheet with the calendar.

I am hoping someone can figure out why and assist me with this.

This is the code that adds to the table form the user form this does work and it adds to bottom of table.
Code:
Private Sub bOkay_Click()


Dim tbl As ListObject
Dim ws As Worksheet
Dim lrow As Range
Dim lrow2 As Long


Set tbl = Sheets("Employee Leave Tracker").ListObjects("tblLeave")

    If tbl.ListRows.Count > 0 Then

        Set lrow = tbl.ListRows(tbl.ListRows.Count).Range
        For col = 1 To lrow.Columns.Count
            If Trim(CStr(lrow.Cells(1, col).Value)) <> "" Then
                tbl.ListRows.Add
                Exit For
            End If
        Next
    End If

    lrow2 = tbl.ListRows.Count

     tbl.DataBodyRange(lrow2, 1).Value = cboEmployee.Value

     tbl.DataBodyRange(lrow2, 2).Value = sDate.Value

     tbl.DataBodyRange(lrow2, 3).Value = eDate.Value

     tbl.DataBodyRange(lrow2, 4).Value = cboType.Value

 Unload Me

EmployeeLeave.Show
End Sub

https://www.dropbox.com/s/dtcn53hrmral27b/testingappluad.xlsm?dl=0

I hope someone is able to assist me with this.
 
Last edited:

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,215,463
Messages
6,124,962
Members
449,200
Latest member
indiansth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top