所以我有一个可以使用的用户窗体,除了关闭按钮。我有简单的关闭代码...
Private Sub vbClose_Click()
Unload Me
End Sub
但是当该部分运行时,由于某些原因,另一个“私人潜艇”启动了...
Private Sub ComboBox_AfterUpdate()
Dim myRng As Range, VIT As Workbook, Sheet As Worksheet, LastRow As Long, myCol As String, LastCol As Long
Dim Loc As Range, CLoc As String, ANLoc As String, CurLoc As String
Set VIT = Workbooks("Workbook.xlsm")
Set Data = Sheets("Sheet")
LastCol = Data.Range("A1").CurrentRegion.Columns.Count
myCol = GetColumnLetter(LastCol)
LastRow = Data.Range("B" & Rows.Count).End(xlUp).Row
Set myRng = Range("H2:H" & LastRow)
Set Loc = myRng.Find(What:=Fund.Value, LookIn:=xlValues)
If Loc.Offset(0, -5).Value = Pool.Value Then <--------- line that breaks
CLoc = Loc.Offset(0, 60)
Cusip.Caption = Format(CLoc, "000000000")
ANLoc = Loc.Offset(0, 40).Value
AcctNum.Caption = Format(ANLoc, "0000")
CurLoc = Loc.Offset(0, 11)
CurrLabel.Caption = CurLoc
Else
Set Loc = myRng.FindNext(After:=Loc)
CLoc = Loc.Offset(0, 60).Value
Cusip.Caption = Format(CLoc, "000000000")
ANLoc = Loc.Offset(0, 40)
AcctNum.Caption = Format(ANLoc, "0000")
CurLoc = Loc.Offset(0, 11)
CurrLabel.Caption = CurLoc
End If
End Sub
感谢您提供任何帮助。