【发布时间】:2014-02-20 15:09:18
【问题描述】:
我正在尝试创建一个宏,该宏将字符串复制到接下来的几个单元格中的浮点数/整数上,直到它碰到另一个字符串。我发现了一些我认为可以工作的代码,并希望帮助修改它(或者如果我应该采取不同的方向,请告诉我):
Sub ReplaceNumberswithText()
' Performs Do loop, testing at top of loop.
' Loops until empty cell is reached.
' Note that you can also use a Do While Not IsEmpty(ActiveCell) loop.
' Test contents of active cell; if active cell is empty, exit loop.
Do Until IsEmpty(ActiveCell)
If ActiveCell.Text Then Text.Copy
End If
' Copies cell contents.
' Step down 1 row to the next cell.
ActiveCell.Offset(1, 0).Select
Selection.Paste
Else: If ActiveCell.Value = 0 Then ActiveCell.Offset(1, 0).Select
End If
' Return to top of loop.
Loop
End Sub
我需要将每个字符串复制到以下浮点数/整数上,直到下一个字符串。然后重复直到列的末尾(A 列)。
【问题讨论】:
-
那太好了。我绝对愿意接受建议......这张表大约有 11,000 行,所以我会说复制粘贴需要几天的艰苦劳动......