我得到一个未定义的配音或功能错误。我在工作表上创建了一个命令按钮,并在按钮子中写了代码,我没有重命名按钮
Private Sub CommandButton1_Click()
'fln = family last name
'fn = first name
'cn2 = child's name
Dim fln As String, fn As String, i As Long
Dim fln2 As String, fn2 As String, cn2 As String, j As Integer
i = 2 'i is set to 2 to take into account column headers
j = 1
fln = Cell(i, 1).Value2
fn = Cell(i, 2).Value2
fln2 = Cell(i + 1, 1).Value2
fn2 = Cell(i + 1, 2).Value2
cn2 = Cell(i + 1, 7).Value2
Do While i < Rows.Count
'if the famlies last name and first name are the same as the ones in the
row below and the row below is not blank
If fln = fln2 And fn = fn2 And fln2 <> "" Then
' move the childs name to the next free column on the original row
Cell(i, 7 + j).Value2 = cn2
'increment the column
j = j + 1
'delete the row with the duplicate
Rows(i + 1).Delete
'else move the dup checker down a row as the current row now has a
complete family listing
Else
i = i + 1
'reset j
j = 1
Loop
'再次开始检查dup family行
答案 0 :(得分:0)
您没有关闭IF
声明。
将END IF
放在LOOP