如何在没有类型声明的情况下理解“ Dim a,b”?

时间:2019-04-26 09:04:32

标签: excel vba

我有一个代码,我试图弄清楚“ F”在此代码中的含义。 Dim q, F

下面的完整代码。

Sub TextBox2_Change()
   Dim MySh As Worksheet
   Dim V As Integer, lastrow As Integer
   Dim M As String
   Dim q, F

   On Error Resume Next

   M = TextBox2.Value

   Set MySh = Sheets("db")

   With MySh
       lastrow = .Cells(.Rows.Count, "b").End(xlUp).Row
       Set q = .Range("b4:b" & lastrow).Find(M, LookIn:=xlValues, Lookat:=xlPart)

       If Not q Is Nothing Then
           F = q.Address

           Do               
               If Application.WorksheetFunction.Search(M, q, 0) = 1 Then
                   ListBox1.AddItem q.Value

                   ListBox1.List(V, 1) = q.Offset(0, 0).Value
                   ListBox1.List(V, 0) = q.Offset(0, -1).Value

                   V = V + 1
               End If

               Set q = .Range("b4:b" & lastrow).FindNext(q)
           Loop While Not q Is Nothing And q.Address <> F
       End If
   End With
End Sub

0 个答案:

没有答案