With WS
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
i = 0
MaxVal = WWorksheetFunction.Max(Range(.Cells(2, 8), .Cells(LastRow, LastCol)))
MaxVal = (WorksheetFunction.Convert((MaxVal), "m", "in"))
For A = 2 To LastRow 'label rows as A, A=1 at row 2
If .Cells(A, 5) > 0 Then
i = i + 1
CurSta = StartStation + (Direction * i)
'--------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------
'-------The below for loop populates the string containing the 37 laser readings-------
'----------------for a 12 foot wide bar centered around the zero laser-----------------
'--------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------
For B = 8 To LastCol 'label columns as B, B=1 at column H
'Enter 39 laser readings to string at 1/10th of a meter spacing (about 4in)
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -2.11) Or (.Cells(1, B).Value = -2.1) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -2.01) Or (.Cells(1, B).Value = -2#) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -1.91) Or (.Cells(1, B).Value = -1.9) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -1.81) Or (.Cells(1, B).Value = -1.8) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -1.71) Or (.Cells(1, B).Value = -1.7) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -1.61) Or (.Cells(1, B).Value = -1.6) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -1.51) Or (.Cells(1, B).Value = -1.5) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -1.41) Or (.Cells(1, B).Value = -1.4) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -1.31) Or (.Cells(1, B).Value = -1.3) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -1.21) Or (.Cells(1, B).Value = -1.2) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -1.11) Or (.Cells(1, B).Value = -1.1) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -1.01) Or (.Cells(1, B).Value = -1#) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -0.91) Or (.Cells(1, B).Value = -0.9) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -0.81) Or (.Cells(1, B).Value = -0.8) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -0.71) Or (.Cells(1, B).Value = -0.7) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -0.61) Or (.Cells(1, B).Value = -0.6) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -0.51) Or (.Cells(1, B).Value = -0.5) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -0.41) Or (.Cells(1, B).Value = -0.4) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -0.31) Or (.Cells(1, B).Value = -0.3) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -0.21) Or (.Cells(1, B).Value = -0.2) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -0.11) Or (.Cells(1, B).Value = -0.1) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = -0.01) Or (.Cells(1, B).Value = -0#) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 0.09) Or (.Cells(1, B).Value = 0.1) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 0.19) Or (.Cells(1, B).Value = 0.2) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 0.29) Or (.Cells(1, B).Value = 0.3) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 0.39) Or (.Cells(1, B).Value = 0.4) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 0.49) Or (.Cells(1, B).Value = 0.5) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 0.59) Or (.Cells(1, B).Value = 0.6) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 0.69) Or (.Cells(1, B).Value = 0.7) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 0.79) Or (.Cells(1, B).Value = 0.8) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 0.89) Or (.Cells(1, B).Value = 0.9) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 0.99) Or (.Cells(1, B).Value = 1) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 1.09) Or (.Cells(1, B).Value = 1.1) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 1.19) Or (.Cells(1, B).Value = 1.2) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 1.29) Or (.Cells(1, B).Value = 1.3) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 1.39) Or (.Cells(1, B).Value = 1.4) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 1.49) Or (.Cells(1, B).Value = 1.5) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 1.59) Or (.Cells(1, B).Value = 1.6) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 1.69) Or (.Cells(1, B).Value = 1.7) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 1.79) Or (.Cells(1, B).Value = 1.8) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 1.89) Or (.Cells(1, B).Value = 1.9) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 1.99) Or (.Cells(1, B).Value = 2#) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
If (.Cells(2, B) <> "") And (.Cells(1, B).Value = 2.09) Or (.Cells(1, B).Value = 2.1) Then
Line = Line + WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
End If
Next
Line = "" 'Clears the Line variable to begin the next iteration
A = A + 150 '150 skips rows to get down to next 50ft increment
End If
Next
End With
Bookmarks