2
我正在使用excel和VBA使用下表中的内容追加单元格。数据从表1中收集。它的代码首先检查B(2)列中的选项是op1
它应该读取列A(1)的内容并附加单元格D2(表2中的op1
以下)。VBA崩溃Excel
然后使用循环遍历表1中的所有值,然后应该连续填充表2,直到超过设置的限制(3)。
表1:
A B
--- ---
text op1
textt op2
text op1
表2:
D
---
op1
*** The Cell I want to Append ***
我正在使用的代码如下所示。
Sub ProcOne()
OpColOne = 4
TextColMain = 1
OpColMain = 2
i = 1
Do Until i > 3
If Cells(i, OpColMain) = "op1" Then
Cells(2, OpColOne) = Cells(2, OpColOne) & vbNewLine & Cells(i, TextColMain)
i = i + 1
End If
Loop
End Sub
@ A.S.H - 我同意。 – Vityata