我嘗試下面的宏將excel名稱「3」中的值複製到當前excel名稱「1」,但是當我執行時,我得到編譯錯誤方法或數據成員未找到我不擅長Vb腳本任何人請幫助我宏從一個工作簿複製和粘貼到當前工作簿
Sub Update()
Dim sPath As String
Dim objExcel As Application
Dim sValue As String
Dim wbTarget As Workbooks
Dim strName As String
Set wbThis = ActiveWorkbook
strName = ActiveSheet.Name
sPath = "C:\Users\nikhil.surendran\Desktop\1"
Set wbTarget = Workbooks.Open("C:\Users\nikhil.surendran\Desktop\3" & strName & ".xlsx")
sValue = wbTarget.Sheets(1).Range("A1").Value
Set objExcel = CreateObject("Excel.Application")
With objExcel
.Visible = False
.DisplayAlerts = 0
.ActiveWorkbook.Sheets(1).Range("B11").Value = sValue
.ActiveWorkbook.Save
.Quit
End With
End Sub
Thanks in Advance.
謝謝Santhosh它工作正常。 – 2013-05-09 11:49:00
@NikhilSurendran歡迎:) – Santosh 2013-05-09 11:57:27