Hello All
As you may have already guessed i am new to VBA coding.
Below is a code were i am attempting to enter data in a user forma and copy it on a worksheet called InvDet.
After i copy the lines i need to copy the lines into another excel sheet that is external to log this data in a invoice register.
Also on my 3 work sheet i have data that the user needs to interact with and categorize into any of the 3 categories. a data line can only belong to one category.
i then have to sum it based on the category selected. i have no clue how to do this using vba code.
The file is attached and below is the code that is giving me errors.
your help and time in reviewing this post is appreciated.
As you may have already guessed i am new to VBA coding.
Below is a code were i am attempting to enter data in a user forma and copy it on a worksheet called InvDet.
After i copy the lines i need to copy the lines into another excel sheet that is external to log this data in a invoice register.
Also on my 3 work sheet i have data that the user needs to interact with and categorize into any of the 3 categories. a data line can only belong to one category.
i then have to sum it based on the category selected. i have no clue how to do this using vba code.
The file is attached and below is the code that is giving me errors.
Code:
Private Sub cmdTran_Click()
Dim ws As Worksheet
Set ws = Worksheets("InvDet")
Worksheets("InvDet").Activate
Dim lrCD As Long
lrCD = Sheets(“InvDet”).Range(“A” & Rows.Count).End(xlUp).Row (error on this line) (subscript out of range, run time error 9)
Sheets(“InvDet”).Cells(lrCD + 1, “A”).Value = txtInv.Text
Sheets(“InvDet”).Cells(lrCD + 1, “B”).Value = txtClient.Text
Sheets(“InvDet”).Cells(lrCD + 1, “C”).Value = txtPoAdd.Text
Sheets(“InvDet”).Cells(lrCD + 1, “D”).Value = txtAdd.Text
Sheets(“CustomerDetails”).Cells(lrCD + 1, “D”).Columns.AutoFit
End Sub
your help and time in reviewing this post is appreciated.