返回列表 上一主題 發帖

[發問] VBA執行時發生執行階段錯誤''91''

回復 1# syuan


    if敘述沒設定到jp
改成
  1. Private Sub ListBox3_Click()
  2. UserForm2.ListBox1.Clear

  3. Set TA = Sheets("sheet1").Range("a2:b6")'設置變數TA
  4. Set JP = Sheets("sheet1").Range("A10:B14")'設置變數JP
  5. If UserForm1.ListBox1.ListIndex = 0 And UserForm1.ListBox2.ListIndex = 0 And UserForm1.ListBox3.ListIndex = 0 Then
  6. With UserForm2.ListBox1
  7.      .ColumnCount = TA.Columns.Count
  8.      .ColumnWidths = "100"
  9.      .List = TA.Value
  10. End With
  11. UserForm2.Show
  12. '----------------------------------------------------
  13. ElseIf UserForm1.ListBox1.ListIndex = 1 And UserForm1.ListBox2.ListIndex = 0 And UserForm1.ListBox3.ListIndex = 0 Then
  14. UserForm2.ListBox1.Clear
  15. With UserForm2.ListBox1
  16.      .ColumnCount = JP.Columns.Count
  17.      .ColumnWidths = "100"
  18.      .List = JP.Value
  19. End With
  20. UserForm2.Show
  21. Else
  22. MsgBox "找不到檔案"
  23. End If
  24. End Sub
複製代碼
學海無涯_不恥下問

TOP

回復 4# PD961A


    1#附件已更新,下載後已是正確rar壓縮檔
上傳附件不接受xls副檔名
要先壓縮後再上傳壓縮檔
學海無涯_不恥下問

TOP

回復 6# PD961A


    原因在於樓主只是把檔案取名為2.rar
實質上該檔案是.xls
我已經將樓主原檔案重新壓縮上傳
所以現在已是正確的.rar了
學海無涯_不恥下問

TOP

        靜思自在 : 閒人無樂趣,忙人無是非。
返回列表 上一主題