excel - 如果范围内的单元格不为空,则在下面插入新行
问题描述
我有 B2:B60 范围内的数字和字母。
如果单元格 B2:B60 中有数据,我想在下面插入一行。
所以它看起来像:
A B
1 e -> EntireRow.Insert below
2
3 3 -> EntireRow.Insert below
4 a -> EntireRow.Insert below
5
6 er -> EntireRow.Insert below
7
8 w -> EntireRow.Insert below
我试过了:
Dim Rng As Range
For Each Rng In Range("B2:B60")
If Is Not Empty (Rng.Value) Then
Rng.Offset(1, 0).EntireRow.Insert
End If
Next
解决方案
If Not IsEmpty
Option Explicit
Sub EmptyRows()
Dim Rng As Range
For Each Rng In Range("B2:B60")
If Not IsEmpty(Rng) Then
Rng.Offset(1, 0).EntireRow.Insert
End If
Next
End Sub
推荐阅读
- android - Circular Avatar ImageView with Text Layover at the bottom
- java - 使用 OAuth 到 Azure AD 的 Java WebApp - 获取个人资料图片?
- java - Gradle for Android:为什么 javaexec 不选择我的类路径?
- php - Laravel whereIn in array
- firebase - Can't select Firebase AB Testing Activation event nor Goal metric event
- python - 如何编写测量每行(对象)频率的函数 - Python
- openedge - 将 FOR EACH 中的行添加到 TEMP-TABLE
- swift - FCM 适用于 Firebase v3.4.1,但不适用于 v5.8.1
- ffmpeg - Crop, Resize and Cut all in one command - FFMPEG
- amazon-web-services - How to set DHCP Options Set via AWS SDK