excel中用宏进行循环判断并作出动作

excel

1个回答

写回答

hhy199969

2025-11-15 03:26

+ 关注

Sub LoopThroughColumn() Dim i As Integer For i = 1 To 100 If Cells(i, 1).Value > 50 Then Cells(i, 1).Interior.ColorIndex = 3 End If Next i End Sub 这段代码会从第一行开始检查A列的值,如果大于50就会把背景色设置为红色。当然你可以根据需求修改范围和条件。

举报有用(0分享收藏

Copyright © 2025 IZhiDa.com All Rights Reserved.

知答 版权所有 粤ICP备2023042255号