ExcelHobbit
New Member
- Joined
- Jan 8, 2020
- Messages
- 23
- Office Version
- 2010
- Platform
- Windows
Hello,
I want to use the left function in VBA, though not in a formula. have the following code, but it isn't working - could be for obvious reasons:
any help would be greatly appreciated.
thanks,
I want to use the left function in VBA, though not in a formula. have the following code, but it isn't working - could be for obvious reasons:
VBA Code:
Range("A2").Select
ActiveCell.Offset(1, 0).Activate
Do Until Cells(ActiveCell.Row, "A").Value = ""
If Left(Cells(ActiveCell.Row, "A"), 1).Value = "L" Then
Cells(ActiveCell.Row, "G").FormulaR1C1 = "IFERROR(VLOOKUP(RC4, 'Sheet2'!C1:C4,3,False), """")"
ActiveCell.Value = ActiveCell.Value
Else
If Left(Cells(ActiveCell.Row, "A"), 1).Value = "Q" Then
Cells(ActiveCell.Row, "G").FormulaR1C1 = "IFERROR(VLOOKUP(RC4, 'Sheet3'!C1:C4,3,False), """")"
ActiveCell.Value = ActiveCell.Value
Else
ActiveCell.Offset(1, 0).Activate
End If
End If
Loop
any help would be greatly appreciated.
thanks,