【问题标题】:How to insert an empty row before a specific cell in a large spreadsheet?如何在大型电子表格中的特定单元格之前插入空行?
【发布时间】:2014-01-21 11:07:50
【问题描述】:

我有一个大的电子表格,大约有 200,000 行,我想在每 100 个序列号之后插入一行,但不是按行号

我找到了一个按行号插入的宏,但这不是我想要的。

【问题讨论】:

标签: vba excel


【解决方案1】:

我想你的意思是:

Dim theRange As Range
Dim idx As Long

Set theRange = Sheet1.UsedRange ''Or other appropriate sheet
idx = Range("A" & Rows.Count).End(xlUp).Row ''Where A is your serial number

For i = idx To 1 Step -1

    If theRange.Cells(i, 1) Mod 100 = 0 Then
       Rows(i).Insert shift:=xlShiftDown
    End If

Next

【讨论】:

  • 谢谢您,先生,这样做只会在第一列中插入一行,但我想在该点(在 101 行之前)为所有列插入一个空行。
  • 我已更改为插入一整行。
  • @user1917229 请不要根据提供的答案编辑标签。答案可能表明使用/不使用早期绑定,但原始标签适用于 THIS QUESTION
猜你喜欢
  • 1970-01-01
  • 2010-10-18
  • 1970-01-01
  • 1970-01-01
  • 2012-08-12
  • 2011-04-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多