vba - Import data from web: repeat loop -
i have vba script works:
sub basic_web_query() activesheet.querytables.add(connection:= _ "url;" & activesheet.range("a2").value, destination:=range("e2")) .name = "q?s=goog_2" .fieldnames = true .rownumbers = false .filladjacentformulas = false .preserveformatting = true .refreshonfileopen = false .backgroundquery = true .refreshstyle = xlinsertdeletecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .webselectiontype = xlspecifiedtables .webformatting = xlwebformattingnone .webtables = "2" .webpreformattedtexttocolumns = true .webconsecutivedelimitersasone = true .websingleblocktextimport = false .webdisabledaterecognition = false .webdisableredirections = false .refresh backgroundquery:=false end end sub i want macro in loop, i.e. go a3 destination e3, a4 destination a4... etc.
any appreciated
thansk!
i use 'offset' these loops: offset(rows down, columns right). negative values move , left.
for example:
for p= 1 5 activesheet.querytables.add(connection:= _ "url;" & activesheet.range("a2").offset(p-1,0).value, destination:=range("e2").offset(p-1,0)) 'other code end next p
Comments
Post a Comment