Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/26.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 用空格下方下一个值的值填充空白单元格 我看到很多帖子从上面的单元格中填充空白单元格。但这里有相反的东西。这里我们可以从下面的细胞中填充空白细胞。< /P>_Excel_Excel Formula_Vba - Fatal编程技术网

Excel 用空格下方下一个值的值填充空白单元格 我看到很多帖子从上面的单元格中填充空白单元格。但这里有相反的东西。这里我们可以从下面的细胞中填充空白细胞。< /P>

Excel 用空格下方下一个值的值填充空白单元格 我看到很多帖子从上面的单元格中填充空白单元格。但这里有相反的东西。这里我们可以从下面的细胞中填充空白细胞。< /P>,excel,excel-formula,vba,Excel,Excel Formula,Vba,当前: A1 = blank A2 = blank A3 = blank A4 = data A1 = data from A4 A2 = data from A4 A3 = data from A4 A4 = data 1. Select A1:A3 2. Press Enter till the active cell become A3 (just before/above the required value) 3. Enter "=" (without quotes) 4. Pre

当前:

A1 = blank
A2 = blank
A3 = blank
A4 = data
A1 = data from A4
A2 = data from A4
A3 = data from A4
A4 = data
1. Select A1:A3
2. Press Enter till the active cell become A3 (just before/above the required value)
3. Enter "=" (without quotes)
4. Press the Down cursor key once/Select the below cell value
5. Press Ctrl+Enter
1. Select the Column where you need to fill the blanks
2. Home -> Find & Select -> Select Blank Function(it will select all the blanks in your selection)
3. Now hit enter until reach a cell which is just before the required cell value.
4. Press "="
5. Press the Down key once / Select the below cell value
6. Hit: Ctrl + Enter
希望:

A1 = blank
A2 = blank
A3 = blank
A4 = data
A1 = data from A4
A2 = data from A4
A3 = data from A4
A4 = data
1. Select A1:A3
2. Press Enter till the active cell become A3 (just before/above the required value)
3. Enter "=" (without quotes)
4. Press the Down cursor key once/Select the below cell value
5. Press Ctrl+Enter
1. Select the Column where you need to fill the blanks
2. Home -> Find & Select -> Select Blank Function(it will select all the blanks in your selection)
3. Now hit enter until reach a cell which is just before the required cell value.
4. Press "="
5. Press the Down key once / Select the below cell value
6. Hit: Ctrl + Enter

解决方案:

A1 = blank
A2 = blank
A3 = blank
A4 = data
A1 = data from A4
A2 = data from A4
A3 = data from A4
A4 = data
1. Select A1:A3
2. Press Enter till the active cell become A3 (just before/above the required value)
3. Enter "=" (without quotes)
4. Press the Down cursor key once/Select the below cell value
5. Press Ctrl+Enter
1. Select the Column where you need to fill the blanks
2. Home -> Find & Select -> Select Blank Function(it will select all the blanks in your selection)
3. Now hit enter until reach a cell which is just before the required cell value.
4. Press "="
5. Press the Down key once / Select the below cell value
6. Hit: Ctrl + Enter
同样,对于完整列,我们可以使用传统的excel技术和选项:

A1 = blank
A2 = blank
A3 = blank
A4 = data
A1 = data from A4
A2 = data from A4
A3 = data from A4
A4 = data
1. Select A1:A3
2. Press Enter till the active cell become A3 (just before/above the required value)
3. Enter "=" (without quotes)
4. Press the Down cursor key once/Select the below cell value
5. Press Ctrl+Enter
1. Select the Column where you need to fill the blanks
2. Home -> Find & Select -> Select Blank Function(it will select all the blanks in your selection)
3. Now hit enter until reach a cell which is just before the required cell value.
4. Press "="
5. Press the Down key once / Select the below cell value
6. Hit: Ctrl + Enter

如果您事先知道A4是要向上复制的单元格,则:

Sub FillCells()
    Range("A1:A3").Value = Range("A4").Value
End Sub
如果您不知道哪个单元格已填充,则:

Sub FillCells2()
    Dim N As Long
    N = Cells(Rows.Count, 1).End(xlUp).Row
    Range("A1:A" & N - 1).Value = Range("A" & N).Value
End Sub
  • 选择A1
  • 按“F2”
  • 输入“=$A$4”(不带引号)或“=R4C1”(在R1C1样式的情况下)
  • 按“回车”
  • 按Ctrl+C组合键
  • 选择A2和A3单元格
  • 按Ctrl+V组合键

  • 填充和处理单独的空白区域:

    Sub FillUp()
    Dim rng1 As Range
    On Error Resume Next
    Set rng1 = Range([a1], Cells(Rows.Count, "A").End(xlUp)).SpecialCells(xlBlanks)
    On Error GoTo 0
    If rng1 Is Nothing Then Exit Sub
    rng1.FormulaR1C1 = "=R[1]C"
    rng1.Value = rng1.Value
    End Sub
    

    到目前为止你试过什么?