我正在一個用戶表單上工作,其中我點擊一個按鈕,當我點擊它時我得到一個輸入框,我嘗試過濾該列(E)的數據,然後過濾後數據從科拉姆A1複製,直到在我使用這個代碼的代碼另一片caaled filtred_data在E欄過濾值,但它給我的錯誤不NW如何解決它VBA-使用輸入框來過濾和複製數據
Private Sub CommandButton9_Click()
Dim xno As Integer, Found As Range
Do
xno = Application.InputBox("Enter the number of Top communities ", Type:=1)
If TypeName(xno) = "Boolean" Then Exit Sub
Set Found = Columns("E").Find(what:=xno, lookat:=xlWhole, LookIn:=xlValues)
If Found Is Nothing Then
MsgBox "the number was not found, please try again !!", vbInformation
Else
Found.Range("A1:F10000").Copy Destination:=Sheets("filtred_data").Range("A1:F10000")
End If
Loop
End Sub
如果有人能幫助我,請,謝謝
你得到的錯誤是什麼?另外,你提到你的工作表是'filtered_data',但你的代碼顯示'filtred_data' –
我得到的錯誤是運行時錯誤9下標超出範圍 – mateos
關於工作表的名稱只是把它錯了我的錯:D – mateos