' 4. 迴圈計算與審核 For i = 2 To LastRow ' 計算 Dim Tax As Double Dim Total As Double Tax = ws.Cells(i, 4).Value * 0.05 Total = ws.Cells(i, 4).Value + Tax ' 填入數值 ws.Cells(i, 5).Value = Tax ws.Cells(i, 6).Value = Total ' --- 會計審核邏輯 --- ' 如果含稅總額大於 400,000,將整列字體變紅色 If Total > 400000 Then ws.Range(ws.Cells(i, 1), ws.Cells(i, 6)).Font.Color = vbRed ws.Range(ws.Cells(i, 1), ws.Cells(i, 6)).Font.Bold = True End If Next i