juliusrhyan
New Member
- Joined
- May 5, 2023
- Messages
- 4
- Office Version
- 2019
- Platform
- Windows
Hi Everyone,
I have a problem which I hope someone would be able to assist me wtih.
I tried an approach I found online wherein you have to divide the formula into two parts However, I'm still receiving Run-Time error '1004:
There was a thread here that resolved someone's code however, I am unable to post on that thread to post my similar problem.
Please find my code below.
I have a problem which I hope someone would be able to assist me wtih.
I tried an approach I found online wherein you have to divide the formula into two parts However, I'm still receiving Run-Time error '1004:
There was a thread here that resolved someone's code however, I am unable to post on that thread to post my similar problem.
Please find my code below.
VBA Code:
Sub FindTranslation()
Dim B_lr As Integer, B_dex, B_rng, B_cel As Range, Page As String
Set B_dex = Me.Range("B8")
B_lr = Me.Cells(Rows.Count, B_dex.Column).End(xlUp).Row
Set B_rng = Range(B_dex.Offset(B_lr), B_dex)
Dim Formula1, Formula2 As String
Formula1 = "=IF(RC[-2]="""","""",RC[-2]&"" "")&IF(TEXTJOIN(""~ "",TRUE,IF(TRIM(RC[-1])=Translations!C[-2],Translations!C[-1],""""))=""""," & "Form2"
Formula2 = "IFERROR(VLOOKUP(TRIM(""*""&RC[-1]&""*""),Translations!C[-2]:C[-1],2,FALSE),""Not Found""),TEXTJOIN(""~ "",TRUE,IF(TRIM(RC[-1])=Translations!C[-2],Translations!C[-1],"""")))"
For Each B_cel In B_rng
Page = InStr(B_cel.Value, "Page")
If B_cel <> "" And B_cel.Offset(, 1).Value = "" And Page = 0 Or B_cel <> "" And B_cel.Offset(, -1).Value <> "" Then
With B_cel.Offset(, 1)
.FormulaArray = Formula1
.Replace "Form2", Formula2, xlPart
End With
End If
Next B_cel
End Sub
Last edited by a moderator: