Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub test()
Dim ws As Worksheet, rngLook As Range, LastRow As Long
Set ws = Sheets("Sheet1")
Set rngLook = ws.Range("H:H")
On Error Resume Next 'if 'Stop' not found
LastRow = rngLook.Find("Stop", after:=rngLook(1), searchorder:=xlByRows, searchdirection:=xlPrevious).Row
If LastRow <> 0 Then
FormatRange ws.Range("A1:H" & LastRow), "none" '"around"
End If
End Sub
Sub FormatRange(rngRef As Range, BorderType As String)
If LCase(BorderType) = "none" Then
rngRef.Borders(xlInsideVertical).LineStyle = xlNone
rngRef.Borders(xlInsideHorizontal).LineStyle = xlNone
rngRef.Borders(xlDiagonalDown).LineStyle = xlNone
rngRef.Borders(xlDiagonalUp).LineStyle = xlNone
rngRef.Borders(xlEdgeBottom).LineStyle = xlNone
rngRef.Borders(xlEdgeLeft).LineStyle = xlNone
rngRef.Borders(xlEdgeRight).LineStyle = xlNone
rngRef.Borders(xlEdgeTop).LineStyle = xlNone
ElseIf LCase(BorderType) = "around" Then
rngRef.BorderAround xlContinuous, xlThin, xlColorIndexAutomatic
End If
End Sub