我试图清除动态范围减去标题的内容。虽然它不排除标题,但下面的效果很好。当我说标题时,我的意思是说我要清除列范围减去第一行
wz3.Worksheets("Sheet1").Range("A2:G").Clear
将其更改为:Sub Test()
Dim wb1 As Excel.Workbook
Set wb1 = Workbooks("Book1")
With wb1.Worksheets("Sheet1")
Call ColumnSelectAndClear(1)
Call ColumnSelectAndClear(2)
ColumnSelectAndClear 3
ColumnSelectAndClear 4
End With
End Sub
Public Sub ColumnSelectAndClear(ColNum As Long)
Set wb1 = Workbooks("Book1")
With wb1.Worksheets("Sheet1")
.Range(.Cells(2, ColNum), .Cells(Rows.Count, ColNum)).ClearContents
End With
End Sub
遗憾的是,不会跳过标题,而是会出错。
虽然您不得不手动记下要清除的每一列,但下面也可以使用。假设你有500列和他们之间的差距计算这个并写这将是一项艰巨的任务...任何帮助真的很感激。
mpirun -n 4 ./mpi2
答案 0 :(得分:1)
Dim lRw As Long
lRw = Range("A:C").SpecialCells(xlCellTypeLastCell).Row
wz3.Worksheets("Sheet1").Range("A2:G" & lRw).Clear
答案 1 :(得分:1)
另一种选择:
Base
所以你可以做+----------------------+
|+--------------------+|
|| int | float ||
|+--------------------+|
| Base object (unnamed)|
+----------------------+
Derived object
。