Я хочу сохранить несколько значений msgbox на основе поиска из разных листов в одном листе с заданным диапазоном.
Я не смог продолжить работу с кодом ниже, используя.
Private Sub SearchData()
Dim Wsheet As Worksheet, myCounter
Dim Loc As Range
Dim sMsg As String
Dim strName As String
On Error Resume Next
strName = InputBox("Please enter the text you are searching for")
If strName = "" Then Exit Sub
For Each Wsheet In ThisWorkbook.Worksheets
With Wsheet.UsedRange
Set Loc = .Cells.Find(What:=strName)
If Not Loc Is Nothing Then
sMsg = MsgBox("Value is found in " & Wsheet.Name)
If MsgBox(sMsg) = vbOK Then
ThisWorkbook.Sheets("Instructions").Range("K14").Value = sMsg
myCounter = 1
Set Loc = .FindNext(Loc)
End If
End With
Next
If myCounter = 0 Then
MsgBox ("Value not present in this workbook")
End If
End Sub