Sub test()
Dim myRng As Range, i As Long
Set myRng = Cells(Rows.Count, 1).End(xlUp)
For i = myRng.Row To 1 Step -1
With Cells(i, 1)
If .Value = "六" Then
.Borders(xlEdgeBottom).LineStyle = xlDouble
Exit For
End If
End With
Next i
i = i - 14
Do Until i <= 0
With Cells(i, 1)
If .Value = "六" Then
.Borders(xlEdgeBottom).LineStyle = xlDouble
End If
End With
i = i - 14
Loop
End Sub
應該是這樣吧
我不會寫vba 所以也不確定@@
For i = 1 To 60
If Cells(i * 14, 1) = "六" Then
Cells(i * 14, 1).Font.Underline = xlUnderlineStyleSingle
End If
Next
看了一下你要從最後一列找
那應該是這樣
For i = lastSaturday To 1 Step -1
If i Mod 14 = 0 And Cells(i, 1) = "六" Then
Cells(i, 1).Font.Underline =xlUnderlineStyleSingle
End If
Next
Private Sub Test()
Dim lastRow As Integer
lastRow = Cells(1, 1).End(xlDown).Row
Dim i As Integer
For i = lastRow To 1 Step -1
If Cells(i, 1).Value = "六" Then
Cells(i, 1).Font.Underline = xlUnderlineStyleDoubleAccounting
If i - 14 > 0 Then
Cells(i - 14, 1).Font.Underline = xlUnderlineStyleDoubleAccounting
End If
MsgBox ("完成!")
Exit For
End If
Next
End Sub
底線樣式可以看 這裡