Excel - import data from an online xls file -
i trying data excel found online sheet on computer. have tried script post (excel - import data online xls file daily ), data in same sheet, instead of creating new sheet/having new workbook open whenever want run macro.
i have tried replacing line:
set wsnew = wbme.sheets.add(after:=wbme.sheets(w))
with: set wsnew = wbme.sheets("sheet9")
this way, tried have sheet9 updated, instead of opening new worksheet everytime run macro.
the full vba code used was:
sub openxlsfromurl() dim wbme workbook dim wsnew worksheet dim w integer dim wburl workbook dim url string set wbme = thisworkbook url = "https://google.com/test.xls" set wburl = workbooks.open(url) '## add code copy data workbook and/or manipulate data...' w = wbme.sheets.count '## add new worksheet end of thisworkbook:' set wsnew = wbme.sheets(sheet9) '## copy & paste data in our new worksheet:' wburl.sheets(1).cells.copy destination:=wsnew.range("a1") '## close downloaded version no longer need:' wburl.close end sub
Comments
Post a Comment