程序如下
Private Sub CommandButton1_click()
numberofrows = Range("A").Rows.Count
numberofcolumns = Range("A").Columns.Count
For i = 1 To numberofrows
For j = 1 To numberofcolumns
If Range("A").Cells(i, j).Value = 5 Then _
Call dadada
Next j
Next i
End Sub
Sub dadada(AnyString)
k = 1
Range("h").Cells(k, 1).Value = i
Range("h").Cells(k, 2).Value = j
k = k + 1
End Sub
主旨是要在A矩阵中找到数值等于5的数并输出到h矩阵中。现在每次运行都不能说不能引用子函数。另外,可能IF语句也有问题,盼大虾们帮帮忙。。。我可是个绝对菜鸟。