Excel将数据从一张纸传输到另一张纸 [英] Excel transfer data from one sheet to another
问题描述
我已经制作了一张包含BVA代码的工作表,以便将输入的数据转移到另一张工作表。这工作正常,但我想在sheet2 t copy中分配一个特定的单元格。我现在从表格的顶部自动复制数据。是否有可能使
条目从另一个点开始。任何人都可以查看我的代码吗?如何添加到此代码中。
I have made a sheet with an code in BVA to tansfer entered data to another sheet. This is working fine, but I want to assign a specific cells in sheet2 t copy too. I now copies the data atomatically from the top of the sheet. Is it possible to make the entries start from another point. Can Anyone take a look a my code? How can I add to this code.
提前谢谢。
亲切的问候,
虹膜
Private Sub Update_Click()
erw = Sheet2.Cells(1, 1).CurrentRegion.Rows.Count + 1
If Len(Range("E11")) <> 0 Then
Sheet2.Cells(erw, 1) = Range("E11")
Sheet2.Cells(erw, 2) = Range("E12")
Sheet2.Cells(erw, 3) = Range("E13")
Sheet2.Cells(erw, 4) = Range("E14")
Range("E11") = ""
Range("E12") = ""
Range("E13") = ""
Range("E14") = ""
Else
MsgBox "You must enter data"
End If
End Sub
推荐答案
Hi,
我
理解 ,我以为你想从Sheet2头插入?如果是这样,您可以执行以下操作:
As i understanding, i assumed that you want to insert from Sheet2 head? If so, you can do this below:
Private Sub Update_Click()
Dim targetRow As Integer
targetRow = 1
Do Until IsEmpty(Sheet2.Cells(targetRow, 1).Value)
targetRow = targetRow + 1
Loop
If Len(Range("E11")) <> 0 Then
Sheet2.Cells(targetRow, 1) = Range("E11")
Sheet2.Cells(targetRow, 2) = Range("E12")
Sheet2.Cells(targetRow, 3) = Range("E13")
Sheet2.Cells(targetRow, 4) = Range("E14")
Range("E11") = ""
Range("E12") = ""
Range("E13") = ""
Range("E14") = ""
Else
MsgBox "You must enter data"
End If
End Sub
希望它可以帮到你。
Hope it helps you.
最好的问候,
Simon
Simon
这篇关于Excel将数据从一张纸传输到另一张纸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!