MostafaNabil
New Member
- Joined
- Feb 20, 2023
- Messages
- 8
- Office Version
- 2019
- Platform
- Windows
I'm working on a code and everything is working fine but I need to set vlookup value from a variable sheet Name with the same structure
I tried many syntax with no use any advise.
This a portion of the code which is related to my issue.
Dim SheetName As Variant
SheetName= DestinationWs.Name
Dim StringVal As String
StringVal = CStr(SheetName)
DestinationWs.Range("L4").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-2],INDIRECT(""'"" & StringVal & ""'!"" & " R[" & OldRemainingLastRowFirst & "]C[12] : R[" & OldRemainingLastRowFirst & "]C[14]),2,0)"
I tried many syntax with no use any advise.
This a portion of the code which is related to my issue.
Dim SheetName As Variant
SheetName= DestinationWs.Name
Dim StringVal As String
StringVal = CStr(SheetName)
DestinationWs.Range("L4").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-2],INDIRECT(""'"" & StringVal & ""'!"" & " R[" & OldRemainingLastRowFirst & "]C[12] : R[" & OldRemainingLastRowFirst & "]C[14]),2,0)"