Hi, I was wondering if someone could please give me a little help. I want to interate through the first column (A4:A20) and if the value of the cell is equal to a certain text then set the value of a specific variable equal to the numeric value of column B right next to that text. I know my sytax/code is wrong in the if statements.
Dim Bvar As Integer
Dim Zvar As Integer
Dim SSvar As Integer
Dim BLvar As Integer
For Each i In Worksheets("Sheet1").Range("A4:A20").Cells
If i.Value = "North" Then Bvar = ActiveCell.FormulaR1C1 = "=RC[1]"
ElseIf i.Value = "South" Then
Set Zvar = ActiveCell.FormulaR1C1 = "=RC[1]"
ElseIf i.Value = "East" Then
Set SSvar = ActiveCell.FormulaR1C1 = "=RC[1]"
ElseIf i.Value = "West" Then
Set BLvar = ActiveCell.FormulaR1C1 = "=RC[1]"
Exit For
End If
Next i
Dim Bvar As Integer
Dim Zvar As Integer
Dim SSvar As Integer
Dim BLvar As Integer
For Each i In Worksheets("Sheet1").Range("A4:A20").Cells
If i.Value = "North" Then Bvar = ActiveCell.FormulaR1C1 = "=RC[1]"
ElseIf i.Value = "South" Then
Set Zvar = ActiveCell.FormulaR1C1 = "=RC[1]"
ElseIf i.Value = "East" Then
Set SSvar = ActiveCell.FormulaR1C1 = "=RC[1]"
ElseIf i.Value = "West" Then
Set BLvar = ActiveCell.FormulaR1C1 = "=RC[1]"
Exit For
End If
Next i