首页 > 解决方案 > 数据没有放在正确的位置

问题描述

我希望我的数据从第 5 行开始,但相反,数据直接到底部。

Private Sub CommandButton6_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("BEAM SUM CONC")

iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1

With ws
.Cells(iRow, "B") = TextBox1.Value
.Cells(iRow, "C") = TextBox2.Value
.Cells(iRow, "D") = TextBox3.Value
.Cells(iRow, "E") = TextBox4.Value
.Cells(iRow, "F") = TextBox5.Value
.Cells(iRow, "G") = TextBox6.Value
.Cells(iRow, "H") = TextBox7.Value

End With
End Sub

怎么样?

标签: excelvba

解决方案


推荐阅读