如果C列中有一个空单元格,请从头开始从B列中获取数据,并将其导入D列中。
我在D6中写道
=OFFSET($B$4:$B$13,$C$2,0,1,1)
和C2我写
=COUNTBLANK($C$4:$C$13)
但结果是App4
答案 0 :(得分:2)
答案 1 :(得分:1)
您可以尝试:
Option Explicit
Sub test()
Dim LastRow As Long, i As Long, Counter As Long
Counter = 4
With ThisWorkbook.Worksheets("Sheet1")
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For i = 4 To LastRow
If .Range("C" & i).Value = "" Then
.Range("D" & i).Value = .Range("B" & Counter).Value
Counter = Counter + 1
End If
Next i
End With
End Sub