I am looking into how best to insert data into an external workbook. I tried using AOD but I was wondering if there was a quick and easy way to just read and wright cells.
Something like Worksheets("SheetName").Range("A1").Value = "Hello World"
But to be able to do that on the external excel workbook file.
Use variables to hold you workbooks and reference those
Dim wb As Workbook , path As String, wbOther As Workbook
path = "workbookpath"
Set wb = Application.Workbooks.Open(path)
Set wbOther = ThisWorkbook
wbOther.Worksheets("Sheet1").Range("A1") = wb.Worksheets("Sheet1").Range("A1")
就像是
Workbooks("BookName").Worksheets("SheetName").Range("A1").Value = "Hello World"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.