最后一行和偏移量组合

时间:2018-08-22 15:49:25

标签: excel vba excel-vba

我找不到此代码有什么问题。当我运行它时,我得到了LRow的编译错误。如果您有帮助,我将不胜感激。预先感谢。

Dim NameTxb As String
Dim DateTxb As Date
Dim WYSTxb As Date
Dim WYETxb As Date
Dim DivCmb As String
Dim PosCmb As String
Dim VacCmb As Integer
Dim Add1Cmb As Integer
Dim Add2Cmb As Integer
Dim MDB As Worksheet:                   Set MDB = ThisWorkbook.Worksheets("MainDataBase")
Dim LRow As Long:                       LRow = MDB.Cells(MDB.Rows.Count, "A").End(xlUp).Row

With Worksheets("MainDataBase").LRow
        LRow.Offset(1, 0).Value = AddWorker.NameTxb.Value
        LRow.Offset(0, 1).Value = AddWorker.DivCmb.Value
        LRow.Offset(0, 2).Value = AddWorker.PosCmb.Value
        LRow.Offset(0, 3).Value = AddWorker.DateTxb.Value
        LRow.Offset(0, 4).Value = AddWorker.WYSTxb.Value
        LRow.Offset(0, 5).Value = AddWorker.WYETxb.Value
        LRow.Offset(0, 6).Value = AddWorker.VacCmb.Value
        LRow.Offset(0, 7).Value = AddWorker.Add1Cmb.Value
        LRow.Offset(0, 7).Value = AddWorker.Add2Cmb.Value

结尾为 结束子

2 个答案:

答案 0 :(得分:1)

With MDB
    .Range("A" & LRow).Offset(1, 0).Value = 
    .Range("A" & LRow).Offset(0, 1).Value =

答案 1 :(得分:0)

行将只是一个数字,而不是行。所以你需要说Worksheets("MainDataBase").row(lrow)