A
Arturo
I have a Vlookup table.
I’m looping through a column of letters.
The value of cell F2 is inserted into named range “_Inâ€.
Named range “_Out†returns what that letter gets converted to.
If there is not a match from the Vlookup, I’m not sure how to handle the
error.
The desired outcome is whatever the value not matching up (varA) should
remain as is.
Sincerely,
Arturo
Sub Convert()
Dim myRange As Range
Dim rO As Integer
Dim coL As Integer
Dim LoopCount_C As Integer
Dim LoopCount_R As Integer
Dim VarA As Variant
Dim VarB As Variant
''' Rows("1:9").Delete Shift:=xlUp
Range("A1").Select
Set myRange = ActiveCell.CurrentRegion
rO = myRange.Rows.Count - 1
coL = myRange.Columns.Count
Range("F2").Select
For LoopCount_C = 1 To coL
For LoopCount_R = 1 To rO
VarA = ActiveCell.Value
Range("_In").Value = VarA
VarB = Range("_Out").Value
'Error Handling Needed.
'If no match is found then
'ActiveCell.Value = VarA
ActiveCell.Value = VarB
ActiveCell.Offset(1, 0).Select
Next
ActiveCell.Offset(-rO, 1).Select
Next
End Sub
I’m looping through a column of letters.
The value of cell F2 is inserted into named range “_Inâ€.
Named range “_Out†returns what that letter gets converted to.
If there is not a match from the Vlookup, I’m not sure how to handle the
error.
The desired outcome is whatever the value not matching up (varA) should
remain as is.
Sincerely,
Arturo
Sub Convert()
Dim myRange As Range
Dim rO As Integer
Dim coL As Integer
Dim LoopCount_C As Integer
Dim LoopCount_R As Integer
Dim VarA As Variant
Dim VarB As Variant
''' Rows("1:9").Delete Shift:=xlUp
Range("A1").Select
Set myRange = ActiveCell.CurrentRegion
rO = myRange.Rows.Count - 1
coL = myRange.Columns.Count
Range("F2").Select
For LoopCount_C = 1 To coL
For LoopCount_R = 1 To rO
VarA = ActiveCell.Value
Range("_In").Value = VarA
VarB = Range("_Out").Value
'Error Handling Needed.
'If no match is found then
'ActiveCell.Value = VarA
ActiveCell.Value = VarB
ActiveCell.Offset(1, 0).Select
Next
ActiveCell.Offset(-rO, 1).Select
Next
End Sub