Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 宏代码校正_Excel_Vba - Fatal编程技术网

Excel 宏代码校正

Excel 宏代码校正,excel,vba,Excel,Vba,我有一个宏在Excel中使用,它为我做一些自动填充。它也会继续通过B列: Sub Autofill() ActiveSheet.Columns("A:A").Select Selection.Unmerge ActiveSheet.Outline.ShowLevels RowLevels:=2 With Range(Range("A8"), Cells(Rows.Count, 3).End(xlUp).Offset(, -1)) .SpecialCells(xlCellTypeB

我有一个宏在Excel中使用,它为我做一些自动填充。它也会继续通过B列:

Sub Autofill()
ActiveSheet.Columns("A:A").Select
Selection.Unmerge
ActiveSheet.Outline.ShowLevels RowLevels:=2
With Range(Range("A8"), Cells(Rows.Count, 3).End(xlUp).Offset(, -1))
        .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
        .Value = .Value
    End With

End Sub

是否可以将代码更改为只查看A列?

现在,使用以下语句:

With Range(Range("A8"), Cells(Rows.Count, 3).End(xlUp).Offset(, -1))
查看A列和B列

范围(“A8”)
开始,到B列
单元格(行数,3)
-C列的最后一行-
。结束(xlup)
-从C列底部开始的第一个使用的单元格-
。偏移(,-1)
-向左偏移一列(B列)

要使其成为一列,只需编写以下内容:

With Range(Range("A8"), Cells(Rows.Count, 1).End(xlUp))

这个适合你吗?由于在a列中使用了-1列偏移量,我收到一个错误。是否要在a列的所有单元格中运行
.SpecialCells