我在excel 2013中的vba中有以下代码,但它仍然给我错误。我尝试将它从表单提供的信息写入excel表但它不起作用..欢迎任何帮助......
Private Sub btnSubmit_Click()
Dim ssheet As Worksheet
Set ssheet = ThisWorkbook.Sheets("testing")
nr = ssheet.Cells(Rown.Count, 1).End(xlUp).Row + 1
ssheet.Cells(nr, 1) = CDate(Me.tbDate)
ssheet.Cells(nr, 2) = Me.cmbCartridges
ssheet.Cells(nr, 3) = Me.tbQuantity
ssheet.Cells(nr, 4) = Me.tbEuros
End Sub
Private Sub UserForm_Initialize()
Me.tbDate = Date
'fill combobox
For Each cell In [CartList]
Me.cmbCartridges.AddItem cell
Next cell
End Sub
在调试模式下,它指出了以下行所需的对象
nr = ssheet.Cells(Rown.Count, 1).End(xlUp).Row + 1
答案 0 :(得分:0)
什么是Rown?您在寻找表格行数吗?
nr = ssheet.Cells(ssheet.Rows.Count, 1).End(xlUp).Row + 1