I have received a macro from another forum that appears to do exactly what I require, though I neglected to mention I needed it in Basic and not VBA, so I am requesting someone to take a look at it and convert it to the type that I need to work with LibreOffice Calc. If anyone can do this for me, I would be extraordinarily grateful.
Thank you.
Code: Select all
Sub ArtLookup()
Dim sValue, rValueAddr As String, rValue As Range, lRow52 As Long, ws As Worksheet
On Error Resume Next
sValue = InputBox("Enter the value you want to search for:", "Search Value?")
If sValue = vbNullString Then Exit Sub
For Each ws In ThisWorkbook.Worksheets
With ws.UsedRange
Set rValue = .Cells.Find(What:=sValue, After:=.Range("A1"), _
LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
If Not rValue Is Nothing Then
rValueAddr = rValue.Address
Do
Set rValue = .FindNext(rValue)
If Worksheets(Sheets.Count).Range("G1").Value = "" Then
lRow52 = 0
Else
lRow52 = Worksheets(Sheets.Count).Cells(Rows.Count, "G").End(xlUp).Row
End If
Worksheets(Sheets.Count).Range("G" & lRow52 + 1).Value = rValue.Offset(, -1).Value
Loop While Not rValue Is Nothing And rValue.Address <> rValueAddr
End If
End With
Set rValue = Nothing
Next
End Sub