整行粘贴失败

时间:2019-10-22 18:46:09

标签: excel vba

我正在尝试将整个信息行粘贴到下一个可用行,但是我不断收到有关正确编写{ "type": "Feature", "properties": { "Name": "Inhumbane Province" }, "geometry": { "coordinates": [ 34.304783, -22.90156 ], "type": "Point" } } 的错误。请让我知道如何正确执行该操作。

Rows(lastrow +1, 1).EntireRow.Paste

1 个答案:

答案 0 :(得分:1)

Private Sub CommandButton1_Click()

    Dim myValue As String
    myEmp = InputBox("Search for an employee by last name")
    ActiveSheet.Range("B3").Value = myEmp

    Dim lastrow As Long
    lastrow = Worksheets("Employee Reports").Range("A65536").End(xlUp).Row

    With Sheet7
        Dim rw As Range
        Set rw = .Range("B:B").Find(What:=myEmp, After:=.Range("B1"), _
        LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, _
        SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)

        If Not rw Is Nothing Then
            rw.EntireRow.Copy Worksheets("Employee Reports").Cells(lastrow + 1, 1)
        Else
            MsgBox myEmp & " Not Found in Range"
        End If
    End With
End Sub