Excel - Auto fetching data from website to excel -


i trying write code automatically data website, replace last part of url address (text: "22a") text have in cell, example, "g1"

code recorded macro:

    sub usa() ' ' usa n-numbers macro '  ' activesheet.querytables.add(connection:= _ "url;http://www6.landings.com/cgi-bin/nph-search_nnr?pass=193800885&&nnumber=22a" _ , destination:=range("$a$1")) .name = "nph-search_nnr?pass=193800885&&nnumber=22a" .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 = "18" .webpreformattedtexttocolumns = true .webconsecutivedelimitersasone = true .websingleblocktextimport = false .webdisabledaterecognition = false .webdisableredirections = false .refresh backgroundquery:=false end columns("a:a").columnwidth = 28.29 columns("b:b").columnwidth = 4.57 end sub 

when replace 22a range("g1").value getting compile error: "expected: list separator or )" knows wrong in coding?

replace:

"url;http://www6.landings.com/cgi-bin/nph-search_nnr?pass=193800885&&nnumber=22a"

with:

"url;www6.landings.com/cgi-bin/nph-search_nnr? pass=193800885&&nnumber=" _ & range("g1").value


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -