|
求助!EXCEL2013为什么打开了一个工作簿,在打开录有宏的工作簿,就会出现下标出界?
代码如下:
Private Sub Image1_Click()
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub UserForm_Initialize()
Dim i As Integer
For i = 5 To Sheet2.Range("A65536").End(xlUp).Row '?????????
Me.ComboBox1.AddItem Sheet2.Cells(i, 1).Value
Next i
Me.ComboBox1.SetFocus
'ComboBox1.Value = "sa"
End Sub
Private Sub CommandButton1_Click() '''''''???????????
Application.ScreenUpdating = False
Sheet2.Range("A2").Value = Me.ComboBox1.Text
If Me.TextBox1.Text = Sheets("??????").Cells(2, 2).Value Then
MsgBox Me.ComboBox1 & " ?????????ù???????", vbInformation, "?????"
Unload ??????
Application.Visible = True
Application.StatusBar = "??????" & Format(Date, "YYYY??M??D???") & "??????????" & Sheet2.Range("A2").Value
Else
MsgBox "???????,???????ù?????!", vbExclamation, "?????"
ThisWorkbook.Close savechanges:=False
End If
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton2_Click()
If MsgBox("?????????????????", vbYesNo + vbInformation, "?????") = vbYes Then
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
If Workbooks.Count > 1 Then
Application.Visible = True
ThisWorkbook.Close False
Else
ThisWorkbook.Close False
Application.Quit
End If
Exit Sub
End If
End Sub
|
|