請幫助我,下面的程序給出了錯誤的對象不支持此屬性或方法用戶窗體跟蹤器V1.3
我試圖將數據從一個工作簿複製並粘貼到另一個工作簿中,但我嘗試了所有我的知識並沒有結果。
Private Sub cmbsendmail_Click()
'Application.Visible = False
'ThisWorkbook.Save
'Dim copyd As String
Dim mydata As String
Dim mypath As String
Dim tfile As String
Dim wbkwo1 As Workbook
Dim wbkwo2 As Workbook
Dim bname As String
Dim Tdate As Date
Workbooks.Open Filename:="C:\Users\Admin\Desktop\Work\Automated.xlsx"
'data location & range to copy
bname = "Nagarjun B"
Range("A5").Formula = "=Today()-1"
Tdate = Range("A5").Value
Range("6:6").Select
Selection.AutoFilter
Range("A6").AutoFilter Field:=2, Operator:= _
xlFilterValues, Criteria1:="Nagarjun B", visibledropdown:=False
Cells.Find(What:=Tdate, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 1).Select
ActiveCell.Offset(0, 1).Select
ActiveCell.Paste
Application.CutCopyMode = False
ThisWorkbook.Save
wbkwo1.Close
Range("C10:AH10").ClearContents
Unload UserForm2
Unload UserForm1
End Sub
預先感謝您 Nagarjun乙
哪一行是拋出的錯誤? – BGeorge
你說這是一個用戶表單?如果是這樣,'ActiveCell'可能是你的問題。在VBA語言參考中,「.ActiveCell返回一個Range對象,它表示活動窗口(窗口頂部)或指定窗口中的活動單元格。如果窗口不顯示工作表,則此屬性將失敗。 https://msdn.microsoft.com/en-us/vba/excel-vba/articles/application-activecell-property-excel?f=255&MSPPError=-2147217396 – BGeorge