I have been trying to setup a userform in excel 2010, but when I write the VBA for the command OK button, I keep getting an error Compile error - method or data member not found, I am not sure why. the error keeps highlighting "Me.txt"Below are the two codes which I tried, on two different forms, and keep getting the same error.Thanks very much for your response.
'copy the data to the databasews.Cells(iRow, 1).Value = Me.txtdate.Valuews.Cells(iRow, 3).Value = Me.txtname.Valuews.Cells(iRow, 4).Value = Me.txtMICostCenter.Valuews.Cells(iRow, 6).Value = Me.txtProjectName.Valuews.Cells(iRow, 7).Value = Me.txtSuppliertocharge.Valuews.Cells(iRow, 10).Value = Me.txtResponsiblPerson.Valuews.Cells(iRow, 11).Value = Me.txtCostCenter.Valuews.Cells(iRow, 12).Value = Me.txthours.Value
Private Sub cmdOK_Click()If Me.txtFirstName.Value = "" ThenMsgBox "Please enter a First Name.", vbExclamation, "Project Information"Me.txtFirstName.SetFocusExit SubEnd IfEnd Sub__,_._,_
ithe data to the databasews.Cells(iRow, 1).Value = Me.txtdate.Valuews.Cells(iRow, 3).Value = Me.txtname.Valuews.Cells(iRow, 4).Value = Me.txtMICostCenter.Valuews.Cells(iRow, 6).Value = Me.txtProjectName.Valuews.Cells(iRow, 7).Value = Me.txtSuppliertocharge.Valuews.Cells(iRow, 10).Value = Me.txtResponsiblPerson.Valuews.Cells(iRow, 11).Value = Me.txtCostCenter.Valuews.Cells(iRow, 12).Value = Me.txthours.Value'copy the data to the databasews.Cells(iRow, 1).Value = Me.txtdate.Valuews.Cells(iRow, 3).Value = Me.txtname.Valuews.Cells(iRow, 4).Value = Me.txtMICostCenter.Valuews.Cells(iRow, 6).Value = Me.txtProjectName.Valuews.Cells(iRow, 7).Value = Me.txtSuppliertocharge.Valuews.Cells(iRow, 10).Value = Me.txtResponsiblPerson.Valuews.Cells(iRow, 11).Value = Me.txtCostCenter.Valuews.Cells(iRow, 12).Value = Me.txthours.Value'copy the data to the databasews.Cells(iRow, 1).Value = Me.txtdate.Valuews.Cells(iRow, 3).Value = Me.txtname.Valuews.Cells(iRow, 4).Value =
Me.txtMICostCenter.Valuews.Cells(iRow, 6).Value = Me.txtProjectName.Valuews.Cells(iRow, 7).Value = Me.txtSuppliertocharge.Valuews.Cells(iRow, 10).Value = Me.txtResponsiblPerson.Valuews.Cells(iRow, 11).Value = Me.txtCostCenter.Valuews.Cells(iRow, 12).Value = Me.txthours.Value
[Non-text portions of this message have been removed]
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (2) |
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar