I am looking a way to get value after finding it whenever I push a button, I have been using cells(rows.count,1).value and so on But still didn't work
here is my code
Private Sub CopyNota_Click()
On Error GoTo errorhandler:
Application.ScreenUpdating = False
Dim strpath As String
Dim copysheet As Worksheet
Dim pastesheet As Worksheet
Set copysheet = Worksheets("sheet3")
Set pastesheet = Worksheets("sheet5")
strpath = "E:\b\"
Filename = Dir(strpath & "b.xlsx")
If IsEmpty(Range("B2")) Then
Workbooks("b.xlsx").Worksheets("sheet3").Range("H2").Copy destination:=Range("B2")
Workbooks("b.xlsx").Worksheets("sheet3").Range("I2").Copy destination:=Range("C2")
Workbooks("b.xlsx").Worksheets("sheet3").Range("J2").Copy destination:=Range("D2")
Workbooks("b.xlsx").Save
Application.CutCopyMode = False
Application.ScreenUpdating = True
Else
Workbooks("b.xlsx").Worksheets("sheet3").Range("H2").Copy
Worksheets("sheet5").Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Workbooks("b.xlsx").Worksheets("sheet3").Range("I2").Copy
Worksheets("sheet5").Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Workbooks("b.xlsx").Worksheets("sheet3").Range("J2").Copy
Worksheets("sheet5").Cells(Rows.Count, 4).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Workbooks("b.xlsx").Worksheets("sheet3").Range("A2").Value = Worksheets("sheet5").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Value
End If
errorhandler:
If Err.Number = "52" Then
MsgBox "Open The Workbooks First!!!"
Exit Sub
End If
End Sub
Would anyone lend me a hand about my problems?
Thanks in advance