hello
I have this code . it searches value across multiple sheets . but the problem when run macro continouisly it repeat copying data haveever been copied before and copy to the bottom
what I would if the data are existed in sheet1 just replace the data when run the macro and if there is no data then should copy to the bottom based on column A
any help experts , please
I have this code . it searches value across multiple sheets . but the problem when run macro continouisly it repeat copying data haveever been copied before and copy to the bottom
what I would if the data are existed in sheet1 just replace the data when run the macro and if there is no data then should copy to the bottom based on column A
VBA Code:
Option Explicit
Sub FindPaste()
Dim rFndCell As Range
Dim stFnd As String
Dim irw As Integer
Dim sh As Worksheet
Dim ws As Worksheet
Dim lw As Integer
Set sh = Sheets("Sheet1")
stFnd = InputBox("Enter Search Text")
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Sheet1" Then
Set rFndCell = ws.Range("A2:J10000").Find(stFnd, LookIn:=xlValues)
If Not rFndCell Is Nothing Then
irw = rFndCell.Row
lw = sh.Range("A" & Rows.Count).End(xlUp).Row + 1
ws.Rows(irw).EntireRow.Copy sh.Cells(lw, 1)
Else
'MsgBox "No Find" 'Uncomment this for no match
End If
End If
Next ws
End Sub