Excel VBA: 按照条件插入行
2014-05-30 15:34
274 查看
Sub Macro1()
Dim softwareVersion As String
Dim recentFlag As String
Dim historyFlag As String
Dim maxRowsNumber As Long
Dim targetColumn As Integer
Dim imageColumn As Integer
maxRowsNumber = 65535
recentFlag = "Y"
historyFlag = "N"
targetColumn = 8
imageColumn = 10
'Enter the newest version in this place
softwareVersion = "3.08.00"
For i = 7 To maxRowsNumber Step 1
If Cells(i, 6) = recentFlag Then
Rows(i).Copy
Rows(i + 1).Insert
Cells(i, 6) = historyFlag
Cells(i + 1, 6) = recentFlag
Cells(i + 1, 8) = softwareVersion
Cells(i + 1, 10) = softwareVersion
i = i + 1
ElseIf Cells(i, 6) = "" Then
i = maxRowsNumber
End If
Next i
End Sub
Sub Macro1()
Dim SoftwareVersion As String
SoftwareVersion = "3.08.00"
For i = 7 To 65535 Step 1
If Cells(i, 6) = "Y" Then
Rows(i).Copy
Rows(i + 1).Insert
Cells(i, 6) = "N"
Cells(i + 1, 6) = "Y"
Cells(i + 1, 8) = SoftwareVersion
Cells(i + 1, 10) = SoftwareVersion
i = i + 1
ElseIf Cells(i, 6) = "" Then
i = 65535
End If
Next i
End Sub
Dim softwareVersion As String
Dim recentFlag As String
Dim historyFlag As String
Dim maxRowsNumber As Long
Dim targetColumn As Integer
Dim imageColumn As Integer
maxRowsNumber = 65535
recentFlag = "Y"
historyFlag = "N"
targetColumn = 8
imageColumn = 10
'Enter the newest version in this place
softwareVersion = "3.08.00"
For i = 7 To maxRowsNumber Step 1
If Cells(i, 6) = recentFlag Then
Rows(i).Copy
Rows(i + 1).Insert
Cells(i, 6) = historyFlag
Cells(i + 1, 6) = recentFlag
Cells(i + 1, 8) = softwareVersion
Cells(i + 1, 10) = softwareVersion
i = i + 1
ElseIf Cells(i, 6) = "" Then
i = maxRowsNumber
End If
Next i
End Sub
Sub Macro1()
Dim SoftwareVersion As String
SoftwareVersion = "3.08.00"
For i = 7 To 65535 Step 1
If Cells(i, 6) = "Y" Then
Rows(i).Copy
Rows(i + 1).Insert
Cells(i, 6) = "N"
Cells(i + 1, 6) = "Y"
Cells(i + 1, 8) = SoftwareVersion
Cells(i + 1, 10) = SoftwareVersion
i = i + 1
ElseIf Cells(i, 6) = "" Then
i = 65535
End If
Next i
End Sub
相关文章推荐
- Excel:利用Excel内置功能实现对某列表格按照条件进行升降序排列——Jason niu
- Excel 单元格按照条件改变背景颜色
- 关于Excel操作编写的一个软件设计构思案例[连载] --保存条件设定的另一种方式:更新与插入方法
- 使用VBA在EXCEL中插入图片自定义函数(网络URL/本地URL)
- Excel中VBA进行插入列、格式化、排序
- VBA: EXCEL中插入指定的行数并添加值
- Excel 按照某一列不同内容插入分页符号
- Excel单元格内插入图片(VBA创建函数,根据图片名称批量插入)
- ExcelVBA:利用SUMIF和OFFSET+MATCH进行多条件求和
- Excel VBA高效办公应用-第五章-销售数据的处理与分析-Part2(多条件筛选及判定)
- Excel 单元格按照条件改变背景颜色
- Excel_VBA:根据条件设定背景色
- 实现Excel行插入行删除特殊处理,单元格合并及动态条件单元格公式自动计算功能的VBA 宏示例
- excel vba编程,是在一段表格中插入几行后,插入行后的行整体下移,不破坏原有数据内容,
- Excel 统计区间频数,按照条件标记
- 在Excel 中用VBA插入图片的方法
- excel通过vba插入行
- Excel VBA 根据筛选条件自动汇总统计(for 铁虎)
- vba 将excel插入sql数据库
- Excel VBA 根据图片名称插入对应图片