excel VBA实现隔行着色
来源:互联网 发布:可口可乐销量数据 编辑:程序博客网 时间:2024/06/06 07:20
Dim worksheet1 As Worksheet
Dim myRange As Range
Dim tempStr As String, cellStr As String, tempIndex As Integer, tempColorIndex As Integer, startIndex As Integer, endIndex As Integer
Set worksheet1 = ThisWorkbook.Worksheets("Sheet1")
tempIndex = 2
startIndex = 2
tempColorIndex = 6
j = 0
While worksheet1.Cells(tempIndex, 1) <> ""
If cellStr <> worksheet1.Cells(tempIndex, 1) And cellStr <> "" Then
' 判断程序进入if条件的次数 每进一次if即换一次组 要对颜色进行一次变化
j = j + 1
If j Mod 2 = 0 Then
tempColorIndex = 6
Else
tempColorIndex = 7
End If
endIndex = tempIndex - 1 ' 一组内组后一条的下标
For i = startIndex To endIndex ' 同一组进行着色 即换组的时候
worksheet1.Range("A" & i & ":E" & i).Interior.ColorIndex = tempColorIndex
Next i
startIndex = endIndex + 1 ' 一组数据开始的下标
End If
cellStr = worksheet1.Cells(tempIndex, 1) ' 中间标量用于判断数据是否换组
tempIndex = tempIndex + 1
Wend
' 最后一组数据的处理
j = j + 1 ' 判断程序进入if条件的次数
If j Mod 2 = 0 Then
tempColorIndex = 6
Else
tempColorIndex = 7
End If
' 最后一组数据的着色
For i = startIndex To tempIndex - 1
worksheet1.Range("A" & i & ":E" & i).Interior.ColorIndex = tempColorIndex
Next i
End Sub
- excel VBA实现隔行着色
- Excel中实现隔行删除
- Excel中实现隔行删除
- listview隔行着色
- [VBA][Tools]Excel VBA密码破解工具(VBA实现)
- BugFree Excel格式化VBA实现
- 【VBA研究】用VBA实现excel与Oracle数据库交互
- Excel VBA密码破解工具(VBA实现)
- VBA实现的Excel Switch函数
- Vba中Listview控件隔行换色的三种实现方式
- Excel Vba
- excel VBA
- Excel VBA
- EXCEL+VBA
- Excel VBA
- Excel VBA
- Excel VBA
- VBA Excel
- Android 系统架构分析
- 培养自己的胆识
- hdu 4487 Maximum Random Walk(简单概率dp)
- unity3d 官方商店下载的文件在那
- 如何使用ajax开发web应用程序(二)
- excel VBA实现隔行着色
- QT-painting-paintdevice
- 添加EGOTableViewPullRefresh时候报错
- 用DataSource控件以外的方法为GridView提供数据
- 如何使用ajax开发web应用程序(三)
- [T9译言]--<敏捷转型>之目录与作者介绍
- Setting Gdb on Windows
- 情绪管理技巧
- [转] android自定义布局中的平滑移动