【发布时间】:2020-10-28 12:08:45
【问题描述】:
我有一个这样构建的不幸数据集,我需要将“姓名:”(名字姓氏)移到每个产品成本的右侧,无论有多少条目以某种方式存在,但无法计算自动执行此操作的逻辑(VBA):
..标题“名称”也需要在“成本”一词旁边..
【问题讨论】:
我有一个这样构建的不幸数据集,我需要将“姓名:”(名字姓氏)移到每个产品成本的右侧,无论有多少条目以某种方式存在,但无法计算自动执行此操作的逻辑(VBA):
..标题“名称”也需要在“成本”一词旁边..
【问题讨论】:
Sub code()
'Define variables
Dim rng As Range
Dim cell As Range
'Find non-empty cells in column B
Set rng = Range("B:B").SpecialCells(xlCellTypeConstants)
'move each non empty cell from column B by 2 rows and 4 columns
For Each cell In rng
cell.Cut Range(cell.Offset(2, 4).Address)
Next cell
End Sub
【讨论】: