我正在尝试为相邻单元格具有值的每个单元格运行宏-这就是我所拥有的。原谅我,因为我是初学者,但我认为它应该有效:
Sub PopulateFormula()
If Len(ActiveCell.Offset(0, 1).Value) Then
Application.CutCopyMode = False
Selection.Copy
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
ActiveCell.Offset(-1, 0).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Value = ""
End If
End Sub