Hello All
I am having trouble understanding why I am getting the "Object Needed" error code when running my code below.
I have created a userform (frmActualCost) for users to enter a job number into a text box (txtJN), and select a fiscal period from a combo box (cboGLP) before clicking "OK" button (cmdOK). When I go to test my macro it is getting hung up at 'SET strJN = Me.txtJN.Text code line. I tried declaring frmActualCost as an object, and searched for other possible solutions but I am unable to solve this.
Can you please take a look and let me know where I went wrong? I appreciate any help.
Thank you
I am having trouble understanding why I am getting the "Object Needed" error code when running my code below.
I have created a userform (frmActualCost) for users to enter a job number into a text box (txtJN), and select a fiscal period from a combo box (cboGLP) before clicking "OK" button (cmdOK). When I go to test my macro it is getting hung up at 'SET strJN = Me.txtJN.Text code line. I tried declaring frmActualCost as an object, and searched for other possible solutions but I am unable to solve this.
Can you please take a look and let me know where I went wrong? I appreciate any help.
Thank you
Code:
Private Sub cmdOK_Click()
On Error GoTo Handler
Dim shtDest, shtSource As Worksheet
Dim wbSource As Workbook
Dim strJN As String
Dim strGLP As String
Dim strURL As String
Dim tblActualCost As ListObject
Dim tblRows As Long
Dim Rng As Range
Dim LastRowSource, LastRowDest, LastRow As Long
Dim objActualCost As Object
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set shtDest = ThisWorkbook.Sheets("Actual Cost")
Set tblActualCost = shtDest.ListObjects("ActualCost_Table")
Set objActualCost = frmActualCost
Set strJN = Me.txtJN.Text
Set strGLP = Me.cboGLP.Value