Option Explicit
Private Sub DirOfMarkA()
Dim rCell As Range, rLast As Range
Dim LRow As Long
'Activesheet and LRow - not needed
LRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row
'personal opinion - since J is the 'main' col being test, I just like to have it used
Set rLast = ActiveSheet.Range("J2").End(xlDown)
With ActiveSheet
For Each rCell In Range("J2", rLast).Cells
'.Offset uses (rows, columns) so (0,-2) not (2,0)
If rCell.Offset(0, -2).Value <> "" Then
Select Case rCell
Case Is < 10
'added space before and after "of" to spacing
rCell.Offset(0, -2) = "N" & " of " & rCell.Offset(0, -3).Value
Case Is < 33
rCell.Offset(0, -2) = "NNE" & " of " & rCell.Offset(0, -3).Value
Case Is < 55
rCell.Offset(0, -2) = "NE" & " of " & rCell.Offset(0, -3).Value
Case Is < 78
'single quote "ENE'
rCell.Offset(0, -2) = "ENE" & " of " & rCell.Offset(0, -3).Value
Case Is < 100
rCell.Offset(0, -2) = "E" & " of " & rCell.Offset(0, -3).Value
Case Is < 123
rCell.Offset(0, -2) = "ESE" & " of " & rCell.Offset(0, -3).Value
Case Is < 145
rCell.Offset(0, -2) = "SSE" & " of " & rCell.Offset(0, -3).Value
Case Is < 168
rCell.Offset(0, -2) = "S" & " of " & rCell.Offset(0, -3).Value
Case Is < 190
rCell.Offset(0, -2) = "SSW" & " of " & rCell.Offset(0, -3).Value
Case Is < 213
rCell.Offset(0, -2) = "SW" & " of " & rCell.Offset(0, -3).Value
Case Is < 235
rCell.Offset(0, -2) = "WSW" & " of " & rCell.Offset(0, -3).Value
Case Is < 258
'rCell, not just Cell
rCell.Offset(0, -2) = "W" & " of " & rCell.Offset(0, -3).Value
Case Is < 280
'single quote "WNW'
rCell.Offset(0, -2) = "WNW" & " of " & rCell.Offset(0, -3).Value
Case Is < 303
rCell.Offset(0, -2) = "NW" & " of " & rCell.Offset(0, -3).Value
Case Is < 325
rCell.Offset(0, -2) = "NNW" & " of " & rCell.Offset(0, -3).Value
Case Is < 347
rCell.Offset(0, -2) = "N" & " of " & rCell.Offset(0, -3).Value
End Select
End If
Next rCell
End With
End Sub
Private Sub DirOfMarkA_1()
Dim vHeading As Variant, vDirection As Variant
Dim iMatch As Long
Dim rRow As Range, rLast As Range
vHeading = Array(10, 33, 55, 78, 100, 123, 145, 168, 190, 213, 235, 258, 280, 303, 325, 347)
vDirection = Array("N", "NNE", "NE", "ENE", "E", "ESE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW", "N")
Set rLast = ActiveSheet.Range("J2").End(xlDown)
With ActiveSheet
For Each rRow In Range("J2", rLast).EntireRow.Rows
With rRow
If .Cells(8).Value <> vbNullString Then
iMatch = Application.WorksheetFunction.Match(.Cells(10).Value, vHeading, 1)
.Cells(8).Value = vDirection(iMatch) & " of " & .Cells(7).Value
End If
End With
Next
End With
End Sub